echo "<a href='next.php?companyname= " '. $myrow['companyname'] .' "> </a>"
I'm trying to echo (this echo is inside a loop) the output from my database and i want them to be clickable links..... the 'companyname' serves as the unique value....pls. help me to correct the syntax and what should I do first before doing the code..should I initialize some stuff first?
thanks....
what's wrong with my code?
Moderator: General Moderators
-
php_postgresql
- Forum Newbie
- Posts: 13
- Joined: Sat Apr 19, 2008 9:37 am
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: what's wrong with my code?
You have quote problems.
Code: Select all
echo '<a href="next.php?companyname='. $myrow['companyname'] .'"> </a>';(#10850)
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
Re: what's wrong with my code?
I prefer to wrap array vars in curly brackets - keeps it clean looking!
Code: Select all
$_curly['brackets'] = "curly brackets";
echo "hello, im using {$_curly['brackets']} around my arrays!";
Re: what's wrong with my code?
Your Single Quotation marks need to be inside the double quotes
like - " ' "
although without the spaces
like - " ' "
although without the spaces
Code: Select all
echo "<a href='next.php?companyname= '".$myrow['companyname']."'> </a>";
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: what's wrong with my code?
I find it useful to use outer single quotes:
This method helps indicate the literal segments of the line using doubles quotes.
Code: Select all
echo '<a href="next.php?companyname=' .$myrow['companyname']. ' "> </a>';