473,771 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse Error

Rob
It's been driving me crazy...why is this returning a parse error? It says
the error is on the last line, I thought I was following the syntax....

<?php

$link = mysql_connect(" localhost");
if(! $link)
die("Could not connect to MySQL");

$database = "PC_Store";
mysql_select_db ($database)
or die ("could not open $database: ".mysql_err or() );

$Choice = $_POST['myradio'];

$db = mysql_connect(" localhost", "root");
mysql_select_db ("PC_Store",$db );

if ($Choice = 'Sales Data') {
?>
<BR>
Enter The Fields For Entry Into SalesData Table
<form action="<?echo $PHP_SELF?>" method=POST>
<input type="text" name="TransID"s ize=10>TransID
<BR><input type="text" name="ProductID "size=10>Produc tID
<BR><input type="text" name="TransCode "size=10>TransC ode
<BR><input type="text" name="Date"size =10>Date
<BR><input type="text" name="UnitsSold "size=10>UnitsS old
<input type="submit" name="submit" value="Submit Data">
</form>
<?php
$result = mysql_query("IN SERT INTO salesdata VALUES
($ProductID,$Tr ansCode,$Date,$ UnitsSold.)",$d b)

}
Jul 17 '05 #1
3 2866
Rob

Got it working....but it won't save to the database...

<HTML>
<HEAD>
<TITLE>PC_Store </TITLE>
</HEAD>
<BODY BGCOLOR=RED>
<?php

$link = mysql_connect(" localhost");
if(! $link)
die("Could not connect to MySQL");

$database = "PC_Store";
mysql_select_db ($database)
or die ("could not open $database: ".mysql_err or() );

$Choice = $_POST['myradio'];

echo "<BR> you picked " . $_POST['myradio'] . "\n";

$db = mysql_connect(" localhost", "root");
mysql_select_db ("PC_Store",$db );

if ($Choice = 'Sales Data') {
?>
<BR>
Enter The Fields For Entry Into SalesData Table
<form action="<?echo $PHP_SELF?>" method=POST>
<input type="text" name="ProductID "size=10>Produc tID
<BR><input type="text" name="TransCode "size=10>TransC ode
<BR><input type="text" name="Date"size =10>Date (YYYY-MM-DD)
<BR><input type="text" name="UnitsSold "size=10>UnitsS old
<input type="submit" name="submit" value="Submit Data">
</form>
<?php
$result = mysql_query("IN SERT INTO salesdata VALUES

('$ProductID',' $TransCode','$D ate','$UnitsSol d')");

}

?>
<BR>
<FORM METHOD=POST ACTION = "PC_Store1.php" >
<INPUT TYPE = "submit" VALUE ="Return To Main Menu">
</FORM>
Jul 17 '05 #2
"Rob" a écrit le 24/11/2003 :
It's been driving me crazy...why is this returning a parse error? It says
the error is on the last line, I thought I was following the syntax....


You forgot the final ; !
Last line becomes :
$result = mysql_query("IN SERT INTO salesdata VALUES
($ProductID,$Tr ansCode,$Date,$ UnitsSold.)",$d b);
Jul 17 '05 #3
> if ($Choice = 'Sales Data') {

More than likely, you probably want this to be

if ($Choice == 'Sales Data') {

(note the double equals). Your original code was setting $Choice to equal
'Sales Data', always returning true.

Chris Finke
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4111
by: Steven | last post by:
I got a "Parse error: parse error in ..." in this line: if(empty($_POST){ ..... But if I fist assign $ssn=$_POST; and then if(empty($ssn){ ... it is working. Any advice? Thanks in advance.
1
2509
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse error before '*'
2
4992
by: Vittal | last post by:
Hello All, I am trying to compile my application on Red Hat Linux 8 against gcc 3.2.2. Very first file in application is failing to compile. I tried compiling my application on Linux 7.2 against gcc 3.1 and it got build without any problems. However on against gcc 3.2.2 I hitting this error:
21
2939
by: BWIGLEY | last post by:
Basically I've just started making a game. So far it makes an array 25 by 20 and tries to make five rooms within it. In scr_make_room() there's parse errors: 20 C:\c\Rooms\Untitled1.c parse error before "top_x" 28 C:\c\Rooms\Untitled1.c parse error before "first_square_x" 35 C:\c\Rooms\Untitled1.c parse error before '}' token Why are these happening? int room_square, selected = 1, squares = 1, first_square_x
6
8598
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar circumstances(XML file source) and with exactly the same value it gets it perfectly correct all the time. These are the results I got, XML is always correct, CSV are only incorrect for some of the values (above about 0.01) but always gives the...
5
64651
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
1
64192
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
1
3752
by: Phaelle | last post by:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' What does that error mean? I can´t find the mistake!! In another script, I have got another kind of mistake : parse error: parse error at .. line (and it is always on the last line!) Thanks for your help Raphaelle
2
3227
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString", $formName); // 06-22-07 - the next commands try to import all the functions that the
5
2708
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me what the fix is. Thanks.
0
9619
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6713
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.