Jump to content

Get Data From 1 Table


igotregistered

Recommended Posts

Hi, new guy gettting started with

 

I've been researching and I found a script which works....However, it's pulling every single record. I want the script to parse the "title" column and only retrieve the records of player names.

 

Example

 

The column "title" in the table has "Bob Smith vs John Doe Apr 1, 2012 hockey team vs hockey team". I want only records which have the name "John Doe" in it. I don't want, any records besides John Doe's.

 

I only want my query to find a single name in the title, (not the whole title)

 

So if this is the title : "Bob Smith vs John Doe Apr 1, 2012 hockey team vs hockey team"

 

I only want to find any records in the table related to "John Doe". Nothing else. HOpe that makes sense.

 

Thank you for any help. :)

 

 

<?php
// Make a MySQL Connection
mysql_connect("10.x.xx.xx", "un", "pw") or die(mysql_error());
mysql_select_db("mydbname") or die(mysql_error());

// Get all the data from the "_mytables" table
$result = mysql_query("SELECT * FROM _mytables") 
or die(mysql_error());  


echo "<table border='1'>";
echo "<tr> <th>Fight Matchup</th> <th>Fight Video</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>"; 
echo $row['title'];
echo "</td><td>"; 
echo $row['link'];
echo "</td></tr>"; 
} 

echo "</table>";
?>

Link to comment
Share on other sites

Hi @gristoi. Thank you for the reply.

 

So would this be correct?

 

<?php
// Make a MySQL Connection
mysql_connect("10.x.xx.xx", "un", "pw") or die(mysql_error());
mysql_select_db("mydbname") or die(mysql_error());

// Get all the data from the "_mytables" table
$result = mysql_query("SELECT * FROM _mytable where title LIKE "%Bobby Robins%")
or die(mysql_error());


echo "<table border='1'>";
echo "<tr> <th>Fight Matchup</th> <th>Fight Video</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['title'];
echo "</td><td>";
echo $row['link'];
echo "</td></tr>";
}

echo "</table>";
?>

Edited by igotregistered
Link to comment
Share on other sites

It's not all of the verbiage in the title I only want the script to pull fights for only one name out of the title, specifically Bobby Robins. Then all of his fights will populate on his own page. Right now my table has 30 thousand various fights from thousands of different fighters.

 

Thank you

Link to comment
Share on other sites

The video script I'm using is a custom script which was made by a developer for vbulletin. I paid for it. It's similar to a youtube script. Basically all I have is category, title, description, keywords.

 

That's it. Thats why the names of the players are all mixed in with each other in the title matchups. They're all categorized by the league they play in.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.