Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-12-2004, 02:46 PM
XinG
Unregistered

Posts: n/a

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"> ???
Reply With Quote
  #2  
Old 12-13-2004, 11:47 AM
XinG
Unregistered

Posts: n/a

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?
Reply With Quote
  #3  
Old 12-14-2004, 04:34 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

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
Reply With Quote
  #4  
Old 12-15-2004, 12:40 PM
Guest
Unregistered

Posts: n/a

<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";
}
?>
Reply With Quote
  #5  
Old 12-15-2004, 06:35 PM
PHP-Largo
Unregistered

Posts: n/a

^^ above is me
Reply With Quote
  #6  
Old 12-16-2004, 11:56 AM
XinG
Unregistered

Posts: n/a

ooooook, cheers, i'll try that!
Reply With Quote
  #7  
Old 12-16-2004, 01:02 PM
XinG
Unregistered

Posts: n/a

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?
Reply With Quote
  #8  
Old 12-26-2004, 11:16 AM
careless_guest
Unregistered

Posts: n/a

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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -5. The time now is 11:16 AM.




Powered by vBulletin®