| | |
can you fix the problem???
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
i get this error:
•
•
•
•
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index, user_id, username, message) VALUES(' ', '4', 'zack', 'jh')' at line 1
PHP Syntax (Toggle Plain Text)
<?php session_start(); $_SESSION['user_id'] = 4; $user_id = $_SESSION['user_id']; $_SESSION['username'] = "zack"; $username = $_SESSION['username']; $message = $_POST['shout_mes']; $insert = $_POST['shout']; if(!empty($message) && $insert = "shout"){ include('mysqlcon.php'); $select = mysql_select_db($db, $con); if(!$select){ die('could not select db: ' . mysql_error()); } $sql = mysql_query("INSERT INTO shoutbox (index, user_id, username, message) VALUES(' ', '$user_id', '$username', '$message')"); if(!$sql){ echo "error" . mysql_error(); }else{ header("location: index.php"); } }else{ echo "there was an error: " . mysql_error(); } ?>
If the user_id data type is numeric, then it won't need single quotes in the sql.
This could also apply to the index, however since you are inserting an empty value, I would assume the datatype is not numeric.
php Syntax (Toggle Plain Text)
$sql = mysql_query("INSERT INTO shoutbox (index, user_id, username, message) VALUES(' ', $user_id, '$username', '$message')");
This could also apply to the index, however since you are inserting an empty value, I would assume the datatype is not numeric.
Last edited by buddylee17; Jan 11th, 2009 at 6:03 pm.
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
![]() |
Similar Threads
- how to fix this problem..urgent.. (ASP.NET)
- Can someone help me fix my problem (Troubleshooting Dead Machines)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- XP Startup problem (Windows NT / 2000 / XP)
- Icon and Thumbnail Display Problem (Windows NT / 2000 / XP)
- mysql start up problem (MySQL)
- SVCHOST PROBLEM HELPP!!!!!!!!!plzz (Windows NT / 2000 / XP)
- weird problem : Internet Explorer cannot load all geocities pages (Windows NT / 2000 / XP)
- IE problem (Web Browsers)
- IE 6 Problem (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: google chekout help
- Next Thread: Online payment Help
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web webdesign websphere white xml youtube





