cinos11 Posted June 8, 2010 Share Posted June 8, 2010 I want to be able to use php to go through a column in the table till it finds the exact name. Then using that spot, inside the row look for other data. I'll make a picture as an example: [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/ Share on other sites More sharing options...
Philip Posted June 8, 2010 Share Posted June 8, 2010 SELECT path FROM yourTable WHERE title='Chatbox' Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069262 Share on other sites More sharing options...
cinos11 Posted June 8, 2010 Author Share Posted June 8, 2010 SELECT path FROM yourTable WHERE title='Chatbox' But then how does it get the path from it next? Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069263 Share on other sites More sharing options...
Philip Posted June 8, 2010 Share Posted June 8, 2010 Use a while loop & mysql_fetch_* Here's a good tutorial (see the bottom example): http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069270 Share on other sites More sharing options...
cinos11 Posted June 8, 2010 Author Share Posted June 8, 2010 when i do: $result = mysql_query("SELECT path FROM cinos11_pages WHERE case='chatbox' "); include($result); it dont show when put into include and get this Warning: include() [function.include]: Filename cannot be empty in /home/*in*s**/*in**s**.com/index.php on line 7 Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/*in*s**/*in**s**.com/index.php on line 7 Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069272 Share on other sites More sharing options...
cinos11 Posted June 8, 2010 Author Share Posted June 8, 2010 Use a while loop & mysql_fetch_* Here's a good tutorial (see the bottom example): http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php I can't use the while loop. It disrupts the php switch which i have set up. The only way i found so far to come up with is to display only the necessary text. Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069273 Share on other sites More sharing options...
Philip Posted June 8, 2010 Share Posted June 8, 2010 What does your current code look like? And doing this: $result is not the actual text results, its the MySQL resource. when i do: $result = mysql_query("SELECT path FROM cinos11_pages WHERE case='chatbox' "); include($result); it dont show when put into include and get this Warning: include() [function.include]: Filename cannot be empty in /home/*in*s**/*in**s**.com/index.php on line 7 Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/*in*s**/*in**s**.com/index.php on line 7 Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069277 Share on other sites More sharing options...
cinos11 Posted June 8, 2010 Author Share Posted June 8, 2010 What does your current code look like? And doing this: $result is not the actual text results, its the MySQL resource. when i do: $result = mysql_query("SELECT path FROM cinos11_pages WHERE case='chatbox' "); include($result); it dont show when put into include and get this Warning: include() [function.include]: Filename cannot be empty in /home/*in*s**/*in**s**.com/index.php on line 7 Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/*in*s**/*in**s**.com/index.php on line 7 I ended up fiquring out $result wasn't the one So i tried using this one: <?php // Make a MySQL Connection mysql_connect("****", "*****", "*****") or die(mysql_error()); mysql_select_db("cinos11") or die(mysql_error()); // Get a specific result from the "example" table $result = mysql_query("SELECT * FROM cinos11_pages WHERE name='chatbox'") or die(mysql_error()); // get the first (and hopefully only) entry from the result $row = mysql_fetch_array( $result ); // Print out the contents of each row into a table echo $row['path']." - ".$row['case']; ?> and it didnt work...... Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069281 Share on other sites More sharing options...
Philip Posted June 8, 2010 Share Posted June 8, 2010 "SELECT * FROM cinos11_pages WHERE name='chatbox'" What is the column "name"? I thought it was "title" - and it is case sensitive. Did you try plugging in my query? Link to comment https://forums.phpfreaks.com/topic/204151-mysql-select-exact-word/#findComment-1069417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.