Jump to content

yellowking

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

yellowking's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. xprez Thanks for coming back to me I'll try that later on and will let you know how I get on. Many thanks for your help.
  2. Hi, I appreciate any help anyone can give me here I hope I'm in the right section for this. I am trying to add banners to my site via php and the code I have keeps coming up with the followng error. Error in SQL query. Cannot add Banner. Please contact with administrator. MySQL: Column count doesn't match value count at row 1 Can someone please check it and let me know what I need to change to get it working. Here is the code<?php require_once('../config/config.php'); require_once('../config/func.php'); $a=$_GET['a']; ?><?php require_once('../config/config.php'); require_once('../config/func.php'); $a=$_GET['a']; $id=$_POST['id']; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>banners</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> <link href="../config/style.css" rel="stylesheet" type="text/css"> </head> <body> <base target="main"> <div class="admin">BANNERS<?php print(($a=='del') ? ' - DELETING' : ' - ADDING'); ?></div><br><br> <?php if (auth()) { if ($a=='del') { if ($result=mysql_query("SELECT `id_banner`, `url` FROM `banners` ORDER BY `id_banner` DESC")) { if (mysql_num_rows($result)>0) { print ('<form method="post" style="text-align:center"><select name="id">'); while ($row=mysql_fetch_assoc($result)) { print('<option value="'.$row['id_banner'].'"'.(($id==$row['id_banner']) ? ' selected' : '').'>'.$row['url'].'</option>'); } print ('</select>&nbsp;&nbsp;<input type="submit" value=" DELETE "></form>'); mysql_free_result($result); } else error('No data in database'); } else error('Error in SQL query! MySQL:<br>' . mysql_error()); // delete if (!empty($id)) { if ($_POST['del']=='yes') { if (mysql_query("DELETE FROM `banners` WHERE `id_banner`='$id'")) { switch_page('banners.php?a=del', 'Deleted banner'); } else error('Error in SQL query. Cannot delete program. Please contact with administrator. MySQL:<br>' . mysql_error() . '<br><br><a href="javascript:history.go(-1)">return</a>'); } else { ?> <form method="post" style="text-align:center"> <input type="hidden" name="id" value="<?=$id ?>"> <input type="hidden" name="del" value="yes"> Are you sure you want to delete?<br> <input type="button" value=" NO " onClick="location.href='banners.php/a=del">&nbsp; <input type="submit" value=" YES "> </form> <?php } } } if ($a=='add') { $link=$_POST['link']; $url=$_POST['url']; $opis=str_replace('"', '&quot;', $_POST['opis']); if (strlen($link) && strlen($url) && strlen($opis)) { if (mysql_query("INSERT INTO `banners` VALUES('', '$url', '$link', '$opis')")) switch_page('banners.php?a=add', 'Added banner'); else error('Error in SQL query. Cannot add Banner. Please contact with administrator. MySQL:<br>' . mysql_error() . '<br><br><a href="javascript:history.go(-1)">return</a>'); } else { if ($_POST['go']=='yes') error('You must fill all fields'); ?> <form method="post"> <input type="hidden" name="go" value="yes"> <table> <tr><td>URL page:</td><td><input type="text" name="link" value="<?php print($link); ?>" maxlength="200" size="70"></td></tr> <tr><td>URL banner:</td><td><input type="text" name="url" value="<?php print($url); ?>" maxlength="100" size="70"></td></tr> <tr><td>Descripion:</td><td><textarea name="opis" cols="66" rows="8"><?php print($opis); ?></textarea></td></tr> <tr><td></td><td><input type="submit" value=" ADD BANNER "></td></tr> </table> </form> <?php } } } ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.