Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-09-2005, 02:58 AM   #1
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
php question

I am new to php and am working on a script to show search results. I am getting the following error with this and was wondering if I am doing something wrong or have the wrong version of php on my server because I am copying this code directly from php5 and mysql4 for dummies and have php4 on my server:

<?php

$user = "user";
$host = "localhost";
$password = "pass";
$database = "database";

$connection = mysql_connect($host,$user,$password)
or die ("Couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");

$query = "SELECT * FROM `features`";
$result = mysql_query($query)
or die ("Couldn't execute query.");

/* Dsiplay results in a table */

echo "<table cellspacing='10' border=0' cellpadding='0' width='100%'?";
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n;

while ($row = mysql_fetch_array{result,MYSQL_ASSOC))
{

/* display row for each listingid */
echo "<tr>\n;
echo "<td>{$row['intersection1']}</td>\n";
?>



I get his error:


Parse error: parse error, unexpected '>' in /public_html/pa/index.php on line 26
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:04 AM   #2
arnette
Confirmed User
 
Join Date: Feb 2005
Posts: 283
you need a " at the end of your echo
arnette is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:04 AM   #3
arnette
Confirmed User
 
Join Date: Feb 2005
Posts: 283
twice

...
arnette is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:09 AM   #4
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
change this:
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n;

to:
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n";

in case it wasn't obvious what arnette said...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:12 AM   #5
arnette
Confirmed User
 
Join Date: Feb 2005
Posts: 283
Quote:
Originally Posted by woj
change this:
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n;

to:
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n";

in case it wasn't obvious what arnette said...
this one too

echo "<tr>\n;

to:
echo "<tr>\n";
arnette is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:14 AM   #6
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
No you didn't close the loop with a }
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:16 AM   #7
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
Also, this is better written from,
Code:
echo "<td>{$row['intersection1']}</td>\n";
to
Code:
echo "<td>".$row['intersection1']."</td>\n";
And when you post code here, use code tags or we might not see what you typed.
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:18 AM   #8
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by V_RocKs
Also, this is better written from,
Code:
echo "<td>{$row['intersection1']}</td>\n";
to
Code:
echo "<td>".$row['intersection1']."</td>\n";
And when you post code here, use code tags or we might not see what you typed.
you edit fast, i was about to call you on your error
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:22 AM   #9
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Still shows same error after changing to:

/* display row for each listingid */
echo "<tr>\n";
echo "<td>{$row['intersection1']}</td>\n";
?>
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:23 AM   #10
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by raulph
Still shows same error after changing to:

/* display row for each listingid */
echo "<tr>\n";
echo "<td>{$row['intersection1']}</td>\n";
?>
you need to close your while loop

put a } before the ?>
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:24 AM   #11
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
also
while ($row = mysql_fetch_array{result,MYSQL_ASSOC)) is wrong,

it should be
while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:25 AM   #12
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Ok changed to:

Code:
/* Dsiplay results in a table */

echo "<table cellspacing='10' border=0' cellpadding='0' width='100%'?";
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n";

while ($row = mysql_fetch_array{result,MYSQL_ASSOC))


/* display row for each listingid */
echo "<tr>\n";
echo "<td>".$row['intersection1']."</td>\n";
?>
Now I get this error:


Parse error: parse error, unexpected '{' in /public_html/pa/index.php on line 22
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:25 AM   #13
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
you didnt copy this code very well...
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:26 AM   #14
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Quote:
Originally Posted by Alky
also
while ($row = mysql_fetch_array{result,MYSQL_ASSOC)) is wrong,

it should be
while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
problem solved. Thanks!
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:26 AM   #15
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
found a few too:
Code:
echo "<table cellspacing='10' border=0' cellpadding='0' width='100%'?";
look at the "border" part, its missing a '
also the "?" at the end of it should be a ">" instead

e.g:
Code:
echo "<table cellspacing='10' border='0' cellpadding='0' width='100%'>";
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:26 AM   #16
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
Did you END the loop?

Code:
while ($row = mysql_fetch_array{result,MYSQL_ASSOC))
{

/* display row for each listingid */
echo "<tr>\n;
echo "<td>{$row['intersection1']}</td>\n";
}
Notice the }
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:26 AM   #17
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
man your screwing it all up ... now you need a { after your while statement
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:27 AM   #18
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Quote:
Originally Posted by Alky
you didnt copy this code very well...
Nope, for a second there I thought php for dummies was for dummies but now I realize I am the dummy. Thanks for everyones help
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:27 AM   #19
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
wow you guys are fast posters
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:27 AM   #20
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by Zester
e.g:
Code:
echo "<table cellspacing='10' border='0' cellpadding='0' width='100%'>";
html with ' is ugly
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:28 AM   #21
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Added the loop, Even better, Thanks!
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:28 AM   #22
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
Not to mention, mysql_assoc_array($result)
would work for that section too.
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:29 AM   #23
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
Quote:
Originally Posted by Alky
man your screwing it all up ... now you need a { after your while statement
haha.. touche... }
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:32 AM   #24
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
One more quicky, how do I make it display Intersection1 & Intersection2 such as "Street1 & Street2" in the line :

echo "<td>".$row['intersection1']."</td>\n";
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:34 AM   #25
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by raulph
Ok changed to:

Code:
/* Dsiplay results in a table */

echo "<table cellspacing='10' border=0' cellpadding='0' width='100%'?";
echo "<tr><td colspan='5' align='right'>Click on any picture to see a larger version.<br><hr></td></tr>\n";

while ($row = mysql_fetch_array{result,MYSQL_ASSOC))


/* display row for each listingid */
echo "<tr>\n";
echo "<td>".$row['intersection1']."</td>\n";
?>
Quote:
Originally Posted by V_RocKs
haha.. touche... }
i was going from that ;)
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:35 AM   #26
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by raulph
One more quicky, how do I make it display Intersection1 & Intersection2 such as "Street1 & Street2" in the line :

echo "<td>".$row['intersection1']."</td>\n";
echo "<td>".$row['intersection1'].$row['intersection2']."</td>\n";
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:38 AM   #27
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Thanks again!
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-09-2005, 03:44 AM   #28
over911
Confirmed User
 
Join Date: Jul 2002
Posts: 1,375
Didnt know ya were into PHP V!

Nice
__________________
over911 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.