Having a problem with 'my' site hehehe...

Having a problem with your site? Post in here, and we'll see what we can do to help!
Post Reply
User avatar
Lan Parker
Petty Officer 3rd Class
Petty Officer 3rd Class
Posts: 77
Joined: Fri Apr 27, 2012 2:17 pm
Location: Wales
Contact:

Having a problem with 'my' site hehehe...

Post by Lan Parker » Tue May 08, 2012 1:33 am

Okay, so I'm being a little cheeky. I have a problem. PHP MySql (Roughly up to date versions).


My problem is, is that $title_of_text is empty....*glares* but I can't figure out what I'm doing wrong with the mysql code >.<;

Code: Select all

if ($db_found) {
		//get number of rows
		$sql = "SELECT * FROM $tblname";
		$result = mysql_query($sql);
		$num_of_rows = mysql_num_rows($result);
		
		//So define maximum
		$end_of_rows = $num_of_rows;

		//while end_of_rows != 0, print rows. 
		for($i = ($end_of_rows + 1); $i > 0; $i--) {
			$sql = "SELECT title FROM $tblename WHERE id='$i'";
			$title_of_text = mysql_query($sql);
			
			echo $title_of_text;

			$sql = "SELECT content FROM $tblename WHERE id='$i'";
			$content_of_text = mysql_query($sql);

			print_text($title_of_text, $content_of_text);
		} 

		//Reached the end of the rows T_T
		
Would help if I named variables correctly -.-; $tblename should have been tblname... XD *goes and gets the self beating stick*
Lan Parker
Ship: Available
Rank: Petty Officer 3rd
Length of Service: 0

Snow Hill (Winter)
Starbase: 332 Rank: Staff Sgt
Length of Service: 18 days
NPC's on Ship: 1. (Kyoko Washington)

[Acting CO] Murik King
Starbase: The Langport Rank: Lt JG
Length of Service: 14
NPC's on Ship 6

Post Reply

Return to “Website Helpdesk”