Jump to content

search a database script


izlik

Recommended Posts

Hey there

 

If some person could help me with this i would be eternely thankfull.

 

let's say i have this form that's shown bellow,

and i when a user inserts their cell number in the field and presses the button,

i want it to search trou the database named "mms" and the table "numbers" and search

for their number on the row ['sender'] for the number enterd, then if a number is found

search the row ['id'] use that it and check if a .jph file in /data/ folder has the same name as that id, and if it exist, display the picture or pictures on the page (if they sent in several) from that number with a link to each picture

 

Edit:

 

Basiclly, i have a page where where i send in my MMS message from my cellphone, when intercepted by my script it's enterd into the database on the Row "ID" and given and uniqe Id number, then the picture is save with that ID name into the folder /data/ and my cellnumber is enterd on the row "sender" in the same database.

 

now what i want is a script form that i cant enter my cellnumber into, press "search" and it searcher the database for "my number" or number (if i sent in more then 1 times" and displays all the images that i have send in with link's to then

 

example

[Picture shown here]

[Link to the picture shown under it]

 

i hope this made more sense

 

HTML:
<form name="input" action="action.php"
method="get">
Cell numbet:
<input type="text" name="user">
<input type="submit" value="Search">
</form>

 

I know how to make the PHP script get the cell number, but i have no idea at all how to make it search for the rest i wanted it to do  :-[

Link to comment
Share on other sites

Write your sql query to retrieve the cell number from the database, then loop through the directory using the dir commands...

 

$query = "SELECT id FROM tablename WHERE cellnumber = 1234567890";

$result = mysql_query($query) or die(mysql_error());

while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) {
  //use dir functions to find the file...
  //reference this page:  http://us2.php.net/manual/en/function.opendir.php#id3253365

  //if file is found, echo html to display here.
}

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.