Why does this show up as a "1"

I made a updatable banner on my site. But when I submit, it just shows up as a 1.

[php]

$bannernotif = mysql_real_escape_string($_POST[‘banner’]) or die(mysql_error());
mysql_query(“UPDATE banner SET notif=’$bannernotif’”) or die (mysql_error());
header(“location: adminpanel.php”);
?>

[/php]

i don’t understand what you asking

what the code you provided does:

[ol][li]Assign the value from a form to a varible[/li]
[li]run an update query set equal the value sumitted from the form[/li]
[li]fianlly redirect to adminpanel.php[/li][/ol]

what do you mean when you say it show up as 1?

Ok, so basically I have this banner. I made a form to update the banner, instead of going into header and editing it. When you put something in the form, and then sumbit. It just shows up as a “1” in the banner. I don’t know if it’s a simple mistake, or a whole complex mistake in my database because the banner is stored in a database table.

so i assume that u have table with a few columns like id, bannerName, url/path

im i correct ?

if that so maybe you are printing the id instead of path to banner

Only 1 column, called Notif.

what do you store in that column?

Whatever will appear on the banner. Like if I type in “Welcome” or something, it will display Welcome in the banner. Then, when I need to change it edits the banner/

great i understand now

can you show me the code where you print banner?

Banner Message

Please Include Your Name After The Message!

Message:
<br />

that’s atually the form you submit to uodate the banner

what i want to see is the codes where you see “1” where u suposely print the banner which i think is adminpanel.php

Well, I had to delete and I forgot to save all my coding…
uhg…

nevermind, found it again. I only have 2 files so I don’t know what you mean by that.

do you have skype?

show the codes of the file named adminpanel.php

The only thing that is in adminpanel.php is the form.

I want to see the code of the file where you see “1”

[php]

<?php $con = mysql_connect("mysql12.000webhost.com","zzzzzzzzz","zzzzzzzz"); mysql_select_db("a1146222_lr"); $result = mysql_query("SELECT * FROM banner") or die(mysql_error());; while($row = mysql_fetch_array($result)) { echo $row['notif'] or die(mysql_error()); } ?>

[/php]

OMG i accidentally gave out my password

yeah make sure you change after we solve this thread

I changed it, lol. so, I showed you that. Now what?

try
[php]
while($row = mysql_fetch_assoc($result))
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service