| | |
Return Car Make from MySQL database & have the make hyperlinked.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 30
Reputation:
Solved Threads: 0
Hi there what i'm trying to do is:
return a car manufacturer from a MySQL database and have the text returned a hyperlink to the car manufacturer website.
The below just returns the manufacturer without a hyperlink:
$row['manufacturer']
Would i make a row in the database called 'carmakeurl', store the URL in that, then somehow echo it out.
$row['<a href=&websiteurl">$title</a>']
????
Thanks
return a car manufacturer from a MySQL database and have the text returned a hyperlink to the car manufacturer website.
The below just returns the manufacturer without a hyperlink:
$row['manufacturer']
Would i make a row in the database called 'carmakeurl', store the URL in that, then somehow echo it out.
$row['<a href=&websiteurl">$title</a>']
????
Thanks
Last edited by jameswoodhouse; Apr 16th, 2009 at 7:20 pm.
If you are trying to retrieve 1 row of a mysql table via link then it is probably best to just have a unique number/hash column and link to the php page with that row id in it. Then when retrieving the row, you can just use
SELECT * FROM `table` WHERE `id`='".mysql_real_escape_string($value)."' As for how to get the unique hash, just hash the date and time the the field was entered. Alternatively you could just make the id field the manufacturer field. Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - MacGyver Fan
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - MacGyver Fan
•
•
Join Date: Apr 2009
Posts: 257
Reputation:
Solved Threads: 37
this is wrong syntax
it could be like
if you are fetching data from db and using it as a link
PHP Syntax (Toggle Plain Text)
$row['<a href=&websiteurl">$title</a>']
it could be like
PHP Syntax (Toggle Plain Text)
<a href='&websiteurl'>$row[title]</a>
Last edited by BzzBee; Apr 17th, 2009 at 7:25 am.
•
•
Join Date: Nov 2006
Posts: 30
Reputation:
Solved Threads: 0
PHP Syntax (Toggle Plain Text)
<a href='&websiteurl'>$row[title]</a>
i think this is what i'm looking for, but what if i want to retrieve the websiteurl from a row in the table as well. would it be like..
PHP Syntax (Toggle Plain Text)
<a href='$row[websiteurl]l'>$row[title]</a>
Thanks
Last edited by jameswoodhouse; Apr 17th, 2009 at 8:08 am. Reason: update
thats going to work, as long as you update the table to include a column of urls, called linkrulrow
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Nov 2006
Posts: 30
Reputation:
Solved Threads: 0
OMG!! this is driving me mad!!!!!!!!!!
I have 1 table with 2 rows in my SQL database. The rows are named:
carwebsiteurl - this contains a URL which is http://www.ford.co.uk
&
carname - this contains the text ford.
It still shows errors!!!!
PHP Syntax (Toggle Plain Text)
$sql = 'SELECT * FROM cartable'; $finalurl = <a href='$row[carwebsiteurl]'>$row[carname]</a>; echo $finalurl;
I have 1 table with 2 rows in my SQL database. The rows are named:
carwebsiteurl - this contains a URL which is http://www.ford.co.uk
&
carname - this contains the text ford.
It still shows errors!!!!
Last edited by Ezzaral; Apr 17th, 2009 at 12:23 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
Hi,
You are missing double quotes
You are missing double quotes
PHP Syntax (Toggle Plain Text)
$sql = 'SELECT * FROM cartable'; $finalurl = <a href='$row["carwebsiteurl"]'>$row[carname]</a>; echo $finalurl;
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
•
•
•
•
Hi,
You are missing double quotes
PHP Syntax (Toggle Plain Text)
$sql = 'SELECT * FROM cartable'; $finalurl = <a href='$row["carwebsiteurl"]'>$row[carname]</a>; echo $finalurl;
php Syntax (Toggle Plain Text)
$sql = 'SELECT * FROM cartable'; $finalurl = '<a href=\''.$row['carwebsiteurl'].'\'>'.$row['carname'].'</a>'; echo $finalurl;
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - MacGyver Fan
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - MacGyver Fan
•
•
Join Date: Nov 2006
Posts: 30
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
$sql = 'SELECT * FROM cartable';$finalurl = '<a href=\''.$row['carwebsiteurl'].'\'>'.$row['carname'].'</a>';echo $finalurl;
Now it just shows a blank page, no errors though!!!!
Last edited by peter_budo; Apr 19th, 2009 at 5:11 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Supplied argument is not a valid MySQL result resource
- Next Thread: Validation of age?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parse paypal pdf php problem query radio random recourse recursion regex remote script search seo server sessions sms soap source space sql static structure syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube






