SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Aug 9, 2000, 02:46 #1
- Join Date
- Jul 2000
- Location
- Nowhere
- Posts
- 278
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Whew, the whole morning I sat here and worked on my database and PHP. Now it's time for testing it and snip there are the problems, as expected
I directly give the code I use here, so I don't have to talk around:
<TD CLASS=plaintext><A HREF="<?php echo( "$url" ); ?>"><?php echo( "$title" ); ?></A> (<?php echo( "$status" ); ?> )</TD>
This is inserted in a plain HTML text file. Further above I already let the PHP script connect to my database. The problem here is that when I call up this page the echos don't seem to work. Here's the URL so you can see the result:
http://www.icosmoss.com/projectdetail.php3
Thanks for any corrections and tips
-
Aug 9, 2000, 12:06 #2
- Join Date
- Jul 1999
- Location
- Derbyshire, UK
- Posts
- 4,411
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just a little thing about your code sample, you don't say if the variables have had a vlue asigned to them anywhere in the script e.g.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
$row = mysql_fetch_array( $res );
$url = $row[url];
[/code]
If they haven't then that is why it is not working.
Also (not related to it not working) for your echos you can trim it down to: echo $url (without the " and () ).
------------------
Karl Austin
KDA Web Services
"Everyone has a photographic memory. Some just don't have film."
-
Aug 9, 2000, 14:01 #3
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
DIMA,
The code you posted above should work fine. I'd guess that there's something wrong with the PHP code that fetches the values from the database. Could you post that?
------------------
-Kevin Yank.
http://www.SitePoint.com/
Helping Small Business Grow Online!
-
Aug 9, 2000, 22:28 #4
- Join Date
- Jul 2000
- Location
- Nowhere
- Posts
- 278
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sure, here it is:
<?php
// connect to the database server
$connection = mysql_connect("localhost", "user", "pass") or die("Ooops! Couldn't make connection.");
// selecting a database in mySQL
$db = mysql_select_db("db", $connection) or die("Ooops! Couldn't select database.");
// request the text of all the info
mysql_query("SELECT author, language, license FROM table");
// define vars
$author = $row["author"];
$language = $row["language"];
$license = $row["license"];
?>
Ohh, by looking at the code more closely I discoved that $row hasn't been defined... This is the error I think.
[This message has been edited by DIMA (edited August 10, 2000).]
-
Aug 9, 2000, 22:30 #5
- Join Date
- Jul 2000
- Location
- Nowhere
- Posts
- 278
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote
/font><HR>Originally posted by Karl:
Just a little thing about your code sample, you don't say if the variables have had a vlue asigned to them anywhere in the script e.g.
If they haven't then that is why it is not working.
Also (not related to it not working) for your echos you can trim it down to: echo $url (without the " and () ).
<HR></BLOCKQUOTE>
The vars have been defined and declared; see my sample code above. BTW thanks for the hint to shorten the code. The change has been made.
[This message has been edited by DIMA (edited August 10, 2000).]
-
Aug 9, 2000, 22:44 #6
- Join Date
- Jul 2000
- Location
- Nowhere
- Posts
- 278
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
GREAT NEWS!!!
IT WORKS!
Hey thanks, I really appreciate your help!
Too see the results go to:
http://www.icosmoss.com/. From there just select a project.
------------------
Matthias Hagemann
Need some source code?
icosmoss.com - The Open Source Community
[This message has been edited by DIMA (edited August 10, 2000).]
Bookmarks