![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2005
Posts: 283
|
you need a " at the end of your echo
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Feb 2005
Posts: 283
|
twice
... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
<&(©¿©)&>
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: Feb 2005
Posts: 283
|
Quote:
echo "<tr>\n; to: echo "<tr>\n"; |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
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 }
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
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"; Code:
echo "<td>".$row['intersection1']."</td>\n"; |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
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"; ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Quote:
put a } before the ?> |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
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)) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
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"; ?> Parse error: parse error, unexpected '{' in /public_html/pa/index.php on line 22 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
you didnt copy this code very well...
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Industry Role:
Join Date: Jul 2003
Posts: 5,344
|
![]() Code:
echo "<table cellspacing='10' border=0' cellpadding='0' width='100%'?"; also the "?" at the end of it should be a ">" instead e.g: Code:
echo "<table cellspacing='10' border='0' cellpadding='0' width='100%'>"; |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
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"; } |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
man your screwing it all up ... now you need a { after your while statement
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#18 | |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 |
Confirmed User
Industry Role:
Join Date: Jul 2003
Posts: 5,344
|
wow you guys are fast posters
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 | |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Added the loop, Even better, Thanks!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#23 | |
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#24 |
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"; |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#25 | ||
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Quote:
Quote:
|
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#26 | |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#27 |
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
|
Thanks again!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#28 |
Confirmed User
Join Date: Jul 2002
Posts: 1,375
|
Didnt know ya were into PHP V!
Nice
__________________
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |