republican-creole
Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » [PHP] Maybe someone can help me
Search Topic:
Uniqs:
228
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Makefile Inheritance (makes calling makes) »
« Dictionary for Password Strength Testing  
AuthorAll Replies


NewLife
Just Keep Swimming, Just Keep Swimming

join:2001-07-31
Calhoun, GA
·AT&T Southeast
·Comcast

[PHP] Maybe someone can help me

I am working on a site: »www.romebraves.com/suites/member···nup.html and I am having a problem with part of my code showing up. What am I missing here?
--
Computer Specs:
AMD 2400 XP/512 PC2700 RAM/128 MEG ASUS 9280TS Video/80 GB HDD/Onboard Sound

"You are the weakest link, GOODBYE!"


GeekNJ
Premium
join:2000-09-23
Waldwick, NJ

From the looks of things, you have a HTML page and not a PHP page being displayed and you included PHP code:

<? .... ?>

It might be as simple as renaming the page to .PHP but that's just a guess based on the limited info you provided.

--
Tweaked your connection? | Mail Parse | Speed Converter


NewLife
Just Keep Swimming, Just Keep Swimming

join:2001-07-31
Calhoun, GA
·AT&T Southeast
·Comcast

said by GeekNJ See Profile:

From the looks of things, you have a HTML page and not a PHP page being displayed and you included PHP code:

<? .... ?>

It might be as simple as renaming the page to .PHP but that's just a guess based on the limited info you provided.

That was it. Soon as I renamed and reuploaded. I appreciate the help.

--
Computer Specs:
AMD 2400 XP/512 PC2700 RAM/128 MEG ASUS 9280TS Video/80 GB HDD/Onboard Sound

"You are the weakest link, GOODBYE!"


NewLife
Just Keep Swimming, Just Keep Swimming

join:2001-07-31
Calhoun, GA
·AT&T Southeast
·Comcast

reply to GeekNJ
OK Geek, you was so quick before that I am coming to you again. Take a look:
<?php

switch($_REQUEST['req']){

case "validate":
$validate = mysql_query("SELECT * FROM customer_info
WHERE username='{$_POST['Username']}'
AND password = md5('{$_POST['Password']}')
AND verified='1'
") or die (mysql_error());

if(mysql_num_rows($validate) == 1){
while($row = mysql_fetch_assoc($validate)){
$_SESSION['login'] = true;
$_SESSION['userid'] = $row['id'];
$_SESSION['suite'] = $row['Suite_Number'];
$_SESSION['email_address'] = $row['Email'];
$_SESSION['cid'] = $row['cart_id'];
setcookie('cid', $unique_cid, time()+24*3600*60);

if($row['admin_access'] == 1){
$_SESSION['admin'] = true;
}

header("Location: /suites/loggedin.php");
} else {
echo '<p align="center">Login Failed</p>';
echo '<p align="center">If you have already joined '.
'our website, you may need to validate your email '.
'address. Please check your email for instructions.';
}
break;

default:
include $_SERVER['DOCUMENT_ROOT'].
'/suites/login_form.html';

break;
}
?>
Heres my error message:
Parse error: parse error, unexpected T_ELSE in /home/romebrav/public_html/suites/login.php
* on line 26

(*) WARNING 1 long line(s) split

I have looked at it and I am fairly new to PHP. Everything looks correct to me.

--
Computer Specs:
AMD 2400 XP/512 PC2700 RAM/128 MEG ASUS 9280TS Video/80 GB HDD/Onboard Sound

"You are the weakest link, GOODBYE!"


Carol
Premium
join:2001-07-08
united state
clubs:
Looks like you're missing a closing bracket on your while statement.


GeekNJ
Premium
join:2000-09-23
Waldwick, NJ
I just walked in from a neighbors house who's computer is so messed up I must just reformat.

I was copy/pasting the code to see when Carol appears to have posted the answer!


Sebastian
Premium
join:2000-12-22
New Haven, CT

reply to Carol
try this, you dont need a loop. also missing a closing curly.

switch ($_REQUEST['req'])
{
case "validate":
$validate = mysql_query("SELECT * FROM customer_info
WHERE username='{$_POST['Username']}'
AND password = md5('{$_POST['Password']}')
AND verified='1'
");

if (mysql_num_rows($validate))
{
$row = mysql_fetch_array($validate);

$_SESSION['login'] = true;
$_SESSION['userid'] = $row['id'];
$_SESSION['suite'] = $row['Suite_Number'];
$_SESSION['email_address'] = $row['Email'];
$_SESSION['cid'] = $row['cart_id'];
setcookie('cid', $unique_cid, time() + 24 * 3600 * 60);

if ($row['admin_access'] == 1)
{
$_SESSION['admin'] = true;
}

header("Location: /suites/loggedin.php");
}
else
{
echo '<p align="center">Login Failed</p>';
echo '<p align="center">If you have already joined ' . 'our website, you may n
*eed to validate your email ' . 'address. Please check your email for instructions.';
}
break;

default:
include $_SERVER['DOCUMENT_ROOT'] . '/suites/login_form.html';
break;
}

(*) WARNING 1 long line(s) split

--
BBR Gaming Server Admin.
http://gaming.broadbandreports.com | http://www.cstrike-planet.com


NewLife
Just Keep Swimming, Just Keep Swimming

join:2001-07-31
Calhoun, GA
Thanks again to everyone. Just another reason I am proud to be a member of this community. I am learning alot in a short amount of time.


NewLife
Just Keep Swimming, Just Keep Swimming

join:2001-07-31
Calhoun, GA
·AT&T Southeast
·Comcast

reply to GeekNJ
Ok, I need some more help here on this one. I have a form for adding the menu items to the database that I have created. It seems to process fine except for the fact that when it gets to the long_description field and tries to insert the text into the database it reads the word and, which then causes it to have a syntax error.

My PHP script code:
<?php
// Include Database Connection File
include $_SERVER['DOCUMENT_ROOT'].
'/suites/common.php';

switch($_REQUEST['req']){
case "process":

// Validate all required fields were posted
if(!$_POST['product_title'] ||
!$_POST['product_price'] ||
!$_POST['caption'] ||
!$_POST['long_description']){

$errors .= "<strong>Form Input Errors:".
"</strong>\n\n";
$error = true;

if(!$_POST['product_title']){
$errors .= "Missing Product Title\n";
}

if(!$_POST['product_price']){
$errors .= "Missing Price\n";
}

if(!$_POST['caption']){
$errors .= "Missing Short Description\n";
}

if(!$_POST['long_description']){
$errors .= "Missing Long Description\n";
}
}

// If $error is TRUE, then include the menu add form
// and display the errors we found.

if($error == true){
$errors = nl2br($errors);
include $_SERVER['DOCUMENT_ROOT'].
'/suites/menu_add.php';
exit();
}

// All checks have passed, insert item in database
$sql = @mysql_query("INSERT INTO menu_products (product_title,
product_price, caption, long_description)
VALUES ('$_POST[product_title]', '$_POST[product_price]', '$_POST[cap
*tion]',
'$_POST[long_description])");
if(!$sql){
echo "Error inserting your information into MySQL: ".mysql_error();
}
break;

default:
include $_SERVER['DOCUMENT_ROOT'].
'/suites/menu_add.php';
break;
}
?>

(*) WARNING 1 long line(s) split

My form code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<!-- This code block dislays errors from the menu add function-->
<?
if($errors){
echo "<p><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\"
color=\"#FF0000\">$errors</font></p>\n";
}
?>
<!--End Error display function-->

<form action="menu_maintenance.php" method="post">
<table width="600" border="0" cellpadding="5" cellspacing="0" bgcolor="E0E4E7">
<tr>
<td colspan="2"><div align="center"><strong>Menu Item Addition Screen</strong></div>
*</td>
</tr>
<tr>
<td width="25%"><font face="Arial, Helvetica, sans-serif">&nbsp;Item Name:</font></t
*d>
<td><input name="product_title" type="text" id="product_title" size="50" maxlength="
*150"></td>
</tr>
<tr>
<td width="25%"><font face="Arial, Helvetica, sans-serif">&nbsp;Item Price
(ea.):</font></td>
<td><input name="product_price" type="text" id="product_price"></td>
</tr>
<tr>
<td width="25%"><font face="Arial, Helvetica, sans-serif">&nbsp;Short Description:<b
*r>
&nbsp;(50 words or less)</font></td>
<td><input name="caption" type="text" id="caption" value="" size="50" maxlength="50"
*></td>
</tr>
<tr>
<td width="25%"><font face="Arial, Helvetica, sans-serif">&nbsp;Long Description:</f
*ont></td>
<td><textarea name="long_description" cols="38" wrap="VIRTUAL" id="long_description"
*></textarea></td>
</tr>
<tr>
<td><font face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
<td>
<input name="req" type="hidden" value="process">
<input type="submit" name="Submit" value="Add">
&nbsp;
<input name="Reset" type="reset" id="Reset" value="Reset"></td>
</tr>
</table>

</form>
</body>
</html>

(*) WARNING 7 long line(s) split

And the error message Iam getting:
Error inserting your information into MySQL: You have an error in your SQL syntax. Check t
*he manual that corresponds to your MySQL server version for the right syntax to use near '
*'this is a full 5 foot long with ham, cheese, tomatoe, lettuce

(*) WARNING 1 long line(s) split

Please help as I am about to pull my hair out.

--
Computer Specs:
AMD 2400 XP/512 PC2700 RAM/128 MEG ASUS 9280TS Video/80 GB HDD/Onboard Sound

"You are the weakest link, GOODBYE!"


GeekNJ
Premium
join:2000-09-23
Waldwick, NJ

I'll take a stab and say it's because you're surrounding your strings with single quotes, entering a single quote in the data is breaking the SQL statement. Do you have a single quote in the data?

If so, and I don't know PHP well, try changing a ' to '', or \' or whatever it is in PHP to tell it to "escape" the quote in the data.

That, or don't enter single quotes
--
Tweaked your connection? | Mail Parse | Speed Converter


NewLife
Just Keep Swimming, Just Keep Swimming

join:2001-07-31
Calhoun, GA
·AT&T Southeast
·Comcast

reply to NewLife
I fixed it. I got to looking at the quotes and in the SQL statement, the long description section didn't have a beginning and ending quote, so I had to add that. Took care of the problem.
--
Computer Specs:
AMD 2400 XP/512 PC2700 RAM/128 MEG ASUS 9280TS Video/80 GB HDD/Onboard Sound

"You are the weakest link, GOODBYE!"


damn
Premium
join:2002-10-23
nyc
reply to NewLife
Get some kind of syntax checker. All your errors are in syntax.


Carol
Premium
join:2001-07-08
united state
clubs:
reply to NewLife
HTML-Kit is a great freeware editor that includes syntax coloring.
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersMakefile Inheritance (makes calling makes) »
« Dictionary for Password Strength Testing  


Tuesday, 24-Nov 04:47:51 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [84] New AT&T Ad Campaign Hits Back At Verizon
· [54] New Bill Takes Aim At Higher Verizon ETFs
· [30] AT&T Offers New Prepaid Wireless plans
· [29] Earthlink Suffers From Major E-mail Outage
· [26] Frontier Increases Modem Rental Fee
· [13] Vivendi In Way Of Comcast's NBC Desires
· [12] Charter Still Fighting With Creditors
· [7] Monday Morning Links
Most people now reading
· Windows 7 boot manager editing questions [Microsoft Help]
· Connecting to Google Voice Via SIP [VOIP Tech Chat]
· What to use while demonoid is down? [Filesharing Software]
· Big Bank Alternative to Bank of America? [General Questions]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· [Config] cisco asa 5505 with multiple outside IP addresses [Cisco]
· Using DIR-615 C1/3.01 with Trendnet TEW-652BRP in N Mode [D-Link]
· DIR-655 1.32 firmware - DNS relay issue (fixed) [D-Link]
· [NV] Speed Upgrade [Cox HSI]