View Full Version : Php Help Please
Johnnikins
23-08-2008, 11:27 PM
I need help with this, i've tried and tried but i just keep getting error upon error, can anybody help?
<?php
// Connects to your Database
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
$data = mysql_query("SELECT * FROM ads")
or die(mysql_error());
if ($data[Paid]) == "Yes" {
echo " ?>
<a href=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[Site]. \"\";} ?>\">
<img src=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[bannerurl]. \"\";} ?>\" border=\"0\"><?php "; } else { echo ""; }?>
Its probobly all messed up but thats why i posted here, can anybody help
Calon
23-08-2008, 11:36 PM
I need help with this, i've tried and tried but i just keep getting error upon error, can anybody help?
<?php
// Connects to your Database
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
$data = mysql_query("SELECT * FROM ads WHERE Paid = 'Yes'")
or die(mysql_error());
if ($data[Paid]) == "Yes" {
echo " ?>
<a href=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[Site]. \"\";} ?>\">
<img src=\"<?php $result=mysql_query('select * from ads');while($row=mysql_fetch_array($result)){echo $row[bannerurl]. \"\";} ?>\" border=\"0\"><?php "; } else { echo ""; }?>Its probobly all messed up but thats why i posted here, can anybody help
<?php
mysql_connect("localhost", "", "") or die(mysql_error()); // Try putting in your username and password
mysql_select_db("") or die(mysql_error()); // Try putting in your database
$query = mysql_query("SELECT * from `ads` WHERE Paid = 'Yes'");
while($data = mysql_fetch_array($query)) {
echo "<img src=\"". $data["bannerurl"] ."\" /><br /><!-- I imagine that you wanted a breakspace -->";
echo $data["Site"];
}
?>
Johnnikins
23-08-2008, 11:44 PM
Thank you so much, and i have put in my username and password & db, but removed them for obvious reasons
Calon
23-08-2008, 11:45 PM
Thank you so much, and i have put in my username and password & db, but removed them for obvious reasons
Fair do'
Please reply if it works, I didn't try it but I re-wrote it completely.
Johnnikins
23-08-2008, 11:46 PM
Yes it works perfectly thanks.
I know my attempt was very very poor :(
Calon
23-08-2008, 11:47 PM
Yes it works perfectly thanks.
I know my attempt was very very poor :(
Ah, w3 schools is good for tutorials, and so is Tizag.com
Johnnikins
23-08-2008, 11:48 PM
Thanks for the advice also, i'll be sure to look on there before i give in :]
Excellent1
23-08-2008, 11:49 PM
There wasn't any need to close php to give the link nor string an if statement with yes, as Calon showed you can just do that with a simple query and loop the links :P
It's not a big error but you may want to read up on PHP a bit more :)
Calon
23-08-2008, 11:50 PM
There wasn't any need to close php to give the link nor string an if statement with yes, as Calon showed you can just do that with a simple query and loop the links :P
It's not a big error but you may want to read up on PHP a bit more :)
Agree'd. :P
Johnnikins
23-08-2008, 11:52 PM
With the one you gave me, is there a way to show a certain banner if there is none with Paid = yes?
Excellent1
23-08-2008, 11:54 PM
With the one you gave me, is there a way to show a certain banner if there is none with Paid = yes?
if($data[paid] = "No") {
echo "<img src='urltothenobanner'>";
}
Johnnikins
23-08-2008, 11:57 PM
Okay, that apparantly wants to show up two banners :s
Calon
23-08-2008, 11:58 PM
if($data[paid] = "No") {
echo "<img src='urltothenobanner'>";
}
<?php
mysql_connect("localhost", "", "") or die(mysql_error()); // Try putting in your username and password
mysql_select_db("") or die(mysql_error()); // Try putting in your database
$query = mysql_query("SELECT * from `ads` WHERE Paid = 'Yes'");
$something = mysql_query("SELECT * from `ads`");
$loldongs = mysql_fetch_array($something);
if($loldongs["Paid"] == "Yes") {
while($data = mysql_fetch_array($query)) {
echo "<img src=\"". $data["bannerurl"] ."\" /><br /><!-- I imagine that you wanted a breakspace -->";
echo $data["Site"];
}
else {
echo "<!-- how private.. --><img src=\"URLTOTHABANNER\"><br />Some descriptive text?";
}
?>
Excellent1
23-08-2008, 11:58 PM
Okay, that apparantly wants to show up two banners :sOops I forgot about the query that was in use before.
Calon
24-08-2008, 12:05 AM
<?php
mysql_connect("localhost", "", "") or die(mysql_error()); // Try putting in your username and password
mysql_select_db("") or die(mysql_error()); // Try putting in your database
$query = mysql_query("SELECT * from `ads` WHERE Paid = 'Yes'");
$something = mysql_query("SELECT * from `ads`");
$loldongs = mysql_fetch_array($something);
if($loldongs["Paid"] == "Yes") {
while($data = mysql_fetch_array($query)) {
echo "<img src=\"". $data["bannerurl"] ."\" /><br /><!-- I imagine that you wanted a breakspace -->";
echo $data["Site"];
}
else {
echo "<img src=\"URLTOTHABANNER\"><br />Some descriptive text?";
}
?>
I think mine might work, I'm really tired and a tiny bit drunk so, sorry if it doesn't work.
Johnnikins
24-08-2008, 12:13 AM
thank you both, i just had to change a few of the names and it worked
:]
Protege
24-08-2008, 07:35 PM
I think mine might work, I'm really tired and a tiny bit drunk so, sorry if it doesn't work.
Wat the hell is that man, that confuses the hell into me...
What did this guy actually want in full context :|
Johnnikins
24-08-2008, 11:24 PM
I wanted a script which would display a certain banner if Paid = Yes, if not it would display an alternative banner, and even though he may have been drunk it worked perfectly
Calon
25-08-2008, 12:39 AM
I wanted a script which would display a certain banner if Paid = Yes, if not it would display an alternative banner, and even though he may have been drunk it worked perfectly
Dude, we don't want people's life stories!
Excellent
25-08-2008, 12:44 AM
Dude, we don't want people's life stories!Stop sucking up to protege.
Calon
25-08-2008, 12:46 AM
Stop sucking up to protege.
How the **** am I sucking up to protege?
I posted before him, I posted on Jonnikins reply.
And that was about me, nothing to do with protege, or you infact.
Excellent
25-08-2008, 12:49 AM
How the **** am I sucking up to protege?
I posted before him, I posted on Jonnikins reply.
And that was about me, nothing to do with protege, or you infact.
Wat the hell is that man, that confuses the hell into me...
What did this guy actually want in full context :|John then stuck up for you and you called it a life story, need I say more?
Protege
25-08-2008, 12:50 AM
They all love me uhmm I feel privileged.
I duno how that works but be nice if he posted it clean :P But good if it worked, good.
Excellent
25-08-2008, 12:51 AM
They all love me uhmm I feel privileged.
I duno how that works but be nice if he posted it clean :P But good if it worked, good.You're loved for being an ego maniac *by some*
Calon
25-08-2008, 12:52 AM
John then stuck up for you and you called it a life story, need I say more?
I didn't even see protege's post.
I meant life story because I was pretending to be a back-street-drunk-tramp, which I'm not, I was a bit drunk 1 night, yet still able to code.
Protege
25-08-2008, 01:02 AM
You're loved for being an ego maniac *by some*
Excellent you have yet to understand the awesomeness of myself.
I am... an awesome great wizard from Hogwartz and I have sexual relations with Hermione, untill she reported me for sexual harrassment but I tell you she enjoyed it - I even put on my wizard hat and invisible cloak.
or I'm a 'fat emo' like you say LOL.
Excellent
25-08-2008, 01:06 AM
Excellent you have yet to understand the awesomeness of myself.
I am... an awesome great wizard from Hogwartz and I have sexual relations with Hermione, untill she reported me for sexual harrassment but I tell you she enjoyed it - I even put on my wizard hat and invisible cloak.
or I'm a 'fat emo' like you say LOL.The only awesome thing I see from you is coding. Second option sir :P
Protege
25-08-2008, 01:07 AM
add me on msn, I show you how emo I rly am
[email protected]
Excellent
25-08-2008, 01:09 AM
add me on msn, I show you how emo I rly am
[email protected] told me not to talk to strangers.
Protege
25-08-2008, 01:11 AM
Okay, Mummy's boy. It's okay.
Calon
25-08-2008, 01:15 AM
@Excellent;
You fail.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.