How can I fix this?
This is the warning: -
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\pos\addmessage.php on line 4
-
This is the code: -
<?php
-
mysql_connect("localhost","root","");
-
@mysql_select_db("pointofsales") or die ("Unable to connect");;
-
$sql=mysql_query("INSERT INTO products(prodid, prodname, description, amount, stocks)VALUES('$_POST[ProdID]','$_POST[ProdName]','$_POST[Description]','$_POST[Amount]','$_POST[Stocks]')";
-
mysql_query($sql);
-
mysql_close();
-
echo "Record is added successfully";
-
?>
-
I'm a beginner. I would appreciate your help. Thanks!
2 1606
Hello,
Try the below code -
<?php
-
mysql_connect("localhost","root","");
-
@mysql_select_db("pointofsales") or die ("Unable to connect");;
-
$sql = "INSERT INTO products(prodid, prodname, description, amount, stocks)
-
VALUES ('".$_POST[ProdID]."',
-
'".$_POST[ProdName]."',
-
'".$_POST[Description]."',
-
'".$_POST[Amount]."',
-
'".$_POST[Stocks]."');";
-
$sql=mysql_query($sql);
-
if(mysql_query($sql)) {
-
echo "Record is added successfully";
-
} else {
-
echo "There is some error";
-
}
-
mysql_close();
-
?>
-
Look at line 3, there's a double semicolon... The error tells you it's row 4 and most of the times, the error is one row earlier.
Steven
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: lawrence |
last post by:
I just switched error_reporting to ALL so I could debug my site. I got
a huge page full of errors. One of the most common was that in my
arrays I'm using undefined offsets and indexes. These still...
|
by: news.bigpond.com |
last post by:
getting errors
Notice: Undefined index: name in F:\uni\Software
engineering\assignment4\guestbook.php on line 6
the variable $name is declared as $name = _POST;
What could be causing this?...
|
by: John Oliver |
last post by:
PHP Notice: Undefined index: name in
/home/www/reformcagunlaws.com/new.php on line 6
PHP Notice: Undefined index: address in
/home/www/reformcagunlaws.com/new.php on line 7
PHP Notice: ...
|
by: cassbiz |
last post by:
Here are the errors that are coming up in my error_log
Notice: Undefined index: andatum in /zipcode.php on line 11
Notice: Undefined index: andatum in /zipcode.php on line 12
Notice: Undefined...
|
by: number1yan |
last post by:
Can anyone help me,
i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is:
Notice:...
| |
by: bill |
last post by:
I am trying to write clean code but keep having trouble deciding
when to quote an array index and when not to.
sometimes when I quote an array index inside of double quotes I
get an error about...
|
by: siyaverma |
last post by:
Hi,
I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that,
After doing some changes when i run it on my...
|
by: sickboy |
last post by:
$channels=$_GET; if (empty($channels)) { $channels='blank'; } changechannels($channels);
$theatre=$_GET; if (empty($theatre)) { $theatre='splash'; } changetheatre($theatre);
$info=$_GET; if...
|
by: razvanel442 |
last post by:
Hi all i am new here!
I take a look on forum but i don't found a the answer for my problem
ok this is my problem:
Line47:$user = $_GET;
Line48:$pass = $_GET;
Line49:$char = $_GET;
|
by: mediator |
last post by:
Hello I have a php contact email form on my a ecommerce shop website !
I am getting a Undefined index error messages coming from the top of the php code, the email form its self works fine,
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |