aznjay Posted September 12, 2008 Share Posted September 12, 2008 Creating a tutorial box: if(isset($_GET['page'])) { $query = "SELECT * FROM phptut"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)){ echo ' <div id="tutorial"><a href="index.php?page='.$row['id'].'">'.$row['title'].'</a> </div>'; echo '<br>'; } }else{ $pagt = $_GET['page']; $query = "SELECT * FROM phptut WHERE id= '$page'"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)){ echo $row['article']; echo '<br>'; } } I tried using that, but the data from table PHPTUT does not show up........basically what i'm trying to do is when the table rows shows as links and when they click on the link it'll give specific data in that row. Can anyone help me recode? fix this? Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/ Share on other sites More sharing options...
Mchl Posted September 12, 2008 Share Posted September 12, 2008 Do you get any errors? Did you connect to database (there's no sign of this in your code)? Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639880 Share on other sites More sharing options...
BlueSkyIS Posted September 12, 2008 Share Posted September 12, 2008 $pagt = $_GET['page']; Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639882 Share on other sites More sharing options...
aznjay Posted September 12, 2008 Author Share Posted September 12, 2008 yes no error but the data doesn't show up...from database Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639889 Share on other sites More sharing options...
BlueSkyIS Posted September 12, 2008 Share Posted September 12, 2008 $pagt = $_GET['page']; ^ that's at least one of the problems. Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639891 Share on other sites More sharing options...
aznjay Posted September 12, 2008 Author Share Posted September 12, 2008 take a look at it it's blank http://alltraxx.uni.cc/phptuts.php....basically what i'm trying to do is creating the data as links for example: I will show the TITLE as the link and when a person click on the title i want the ARTICLE to show up in that specific title. Can anyone create me a script that can do that? I'm going nuts... Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639897 Share on other sites More sharing options...
Mchl Posted September 12, 2008 Share Posted September 12, 2008 Did you fix the typo BlueSkyIS is showing you? Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639901 Share on other sites More sharing options...
aznjay Posted September 12, 2008 Author Share Posted September 12, 2008 I did and it still does not work.. Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639929 Share on other sites More sharing options...
Mchl Posted September 12, 2008 Share Posted September 12, 2008 Do you have error reporting enabled? Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639932 Share on other sites More sharing options...
aznjay Posted September 12, 2008 Author Share Posted September 12, 2008 Can someone code this for me please? It'll be appreciated. Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639952 Share on other sites More sharing options...
Mchl Posted September 12, 2008 Share Posted September 12, 2008 You mean error reporting? Sure. Add: ini_set('error_reporting', E_ALL); ini_set('display_errors','On'); at the very beginning of your script. Then we will see if there are any errors that prevent script from working as intended. Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639961 Share on other sites More sharing options...
revraz Posted September 12, 2008 Share Posted September 12, 2008 Your logic makes absolutely no sense. Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639978 Share on other sites More sharing options...
aznjay Posted September 12, 2008 Author Share Posted September 12, 2008 Here is the error : Undefined index: page in /home/jayjay/public_html/phptuts.php on line 20 Sorrie i'm a newbie at php programming..thats why i need expertz Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639983 Share on other sites More sharing options...
Mchl Posted September 12, 2008 Share Posted September 12, 2008 Now we're getting somewhere Could you post what's on line 20 in your script? Link to comment https://forums.phpfreaks.com/topic/123958-linking-mysql-database/#findComment-639990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.