#1
|
||
|
Links to ID's
In the news script I have created I have the news in the center and headlines on the bottom right, in bullet format. I want these to work so that when you click them, they bring the full news page up (with that article). I presume this is by using ID's can anyone help?
<a href="$id" target="_blank"> ??? |
#2
|
||
|
and also - to do with the ID's...
in the table for news i have.. i have id author message date the first 2 posts are - ID 1 and 2 the others are - 16+ wheres the other 15 gone? is it cos i had to change the message type to BLOB? (as it was varchar (255) i couldnt fit the whole post on! ) can anyone help with that too? |
#3
|
||
|
First, you do not need blob for the news. That's basically for binary data. Use TEXT. There is a limit to that but I have never come across it.
Second, if you have the ID's to auto increase, then if you delete 3 through 15, 16 will be next inline. It does not go to the next number in line unless the next number in line wasen't used yet. If you want to number your fields, just do something like this: $i++; echo "News id: ".$i." News Title etc"; all in your while() loop.
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#4
|
||
|
<a href=\"print.php?newsid=$myrow[id]\" target=\"_blank\">$myrow[title]</a>
<? //print.php?newsid= $realid=$id; $query=mysql_query"SELECT * FROM blabla WHERE id='$realid'"; while($myrow=mysql_fetch_array($query)){ echo"story"; } ?> |
#5
|
||
|
^^ above is me
|
#6
|
||
|
ooooook, cheers, i'll try that!
|
#7
|
||
|
well that was no good lol
i probably cant understand it right.. but o well this is the code i have for delnews.php: <head><title>Delete News</title></head> <? mysql_connect(localhost,DB_NAME,DB_PASS); mysql_select_db(DB_NAME); $result = mysql_query("SELECT * FROM news order by id DESC LIMIT 7"); while ($row = mysql_fetch_array($result)) { $title = $row["title"]; $date = $row["date"]; echo "<ul><li><b>$title</b> - $date</li></ul>"; ++$i; } if(mysql_num_rows($result) == 0) { echo "<strong>There are currently no news articles in the database!</strong>"; } ?> <a href="./print.php?newsid=$myrow[id]" target="_blank">$myrow[title]</a> how can i get an option next to all of them saying - Delete? then by pressing this "link" deleting the item you pressed? |
#8
|
||
|
carelessrabbit@hotmail.com for more help :p
1st of all ditch the my_row stuff
use:: mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query("SELECT * FROM news order by id DESC LIMIT 7"); $result = mysql_query($query) or die (mysql_error()); $num = mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $title=mysql_result($result,$i,"title"); $date=mysql_result($result,$i,"date"); WHATEVER $i++; } } if(mysql_num_rows($result) == 0) { echo "<strong>There are currently no news articles in the database!</strong>"; } ?> just i hate using your method of SQL grabbin |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
php?id= | spinal | Web design and Programming | 15 | 06-20-2005 04:27 PM |
UK ID cards | -Tigger- | General Chat | 16 | 05-31-2005 04:14 PM |
request id done | Jason | Sigs and Graphics | 6 | 04-27-2005 08:24 PM |
Things id like to see......... | .DareDevil. | Delta Force | 11 | 05-20-2004 03:53 PM |