twittoris Posted September 4, 2010 Share Posted September 4, 2010 I have a list names in a database table in MySQL that I need to repeat the same search for on my system to get the associated information. Is there a Loop command or some type of trick to making a php script search table1.row1 then table1.row2 then table1.row3 etc. Basically using the row in the table as a variable for the other commands in the code. I really need some direction. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/ Share on other sites More sharing options...
twittoris Posted September 4, 2010 Author Share Posted September 4, 2010 This cant be that hard to explain. Is it? How do I loop mysql lookups as variables to be entered into URLs in php? Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/#findComment-1107305 Share on other sites More sharing options...
freeloader Posted September 4, 2010 Share Posted September 4, 2010 I'm not sure I totally understand your question. Could you specify it and post your current query. Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/#findComment-1107306 Share on other sites More sharing options...
twittoris Posted September 4, 2010 Author Share Posted September 4, 2010 I have a db called names with two columns, name and link. i have script that can run a name through a webpage by posting the data but i dont know how to make the script get the name from the db and then enter the corresponding link then go to the name in the next row within mysql. Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/#findComment-1107331 Share on other sites More sharing options...
wildteen88 Posted September 4, 2010 Share Posted September 4, 2010 I have a db called names with two columns, name and link. i have script that can run a name through a webpage by posting the data but i dont know how to make the script get the name from the db and then enter the corresponding link then go to the name in the next row within mysql. That still not very clear. You'll need to post an example of what you're trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/#findComment-1107333 Share on other sites More sharing options...
freeloader Posted September 4, 2010 Share Posted September 4, 2010 So you're looking for something like this? I still don't fully understand the second part of what you're trying to do though. $sql = "SELECT * FROM names"; $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR); $nrlines = mysql_num_rows($result); for ($i = 0; $i < $nrlines; $i++) { $stats = mysql_fetch_array($result); $name = $stats['name ']; $link = $stats['link']; echo $link; } Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/#findComment-1107334 Share on other sites More sharing options...
twittoris Posted September 5, 2010 Author Share Posted September 5, 2010 Thanks I think I need something similar to that. I am using cURL to POST a form submission. I have a list of names (searches for the form) in mySQL. So I think I need to do something like this within a loop to replace $nlink with each name in my mySQL table. curl_setopt ($ch, CURLOPT_POSTFIELDS, 'p_entity_name='+$nlink+'&p_name_type=A&p_search_type=BEGINS'); Quote Link to comment https://forums.phpfreaks.com/topic/212536-using-mysql-tables-and-php-to-capture-custom-made-urls/#findComment-1107636 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.