MySQL Forums
Forum List  »  PHP

Binary codes
Posted by: Yen Dinh
Date: July 13, 2005 12:50PM

I have this script running every now and then to read the photos of books into booksxyz.com database.

<?
include("dsource.php");
global $isbn;
global $fileisbn;
$fd=fopen ("cover3.txt", "r") or die ('Cannot find file');
while (!feof($fd))
{
$line = fgets($fd, 4096);
$fileisbn=strtok($line, "\t");
$isbn = strtok("\t");
$isbn = (INTEGER) $isbn;

$query1 = "SELECT book_id FROM book_info WHERE book_isbn = $isbn";
$result1 = MYSQL_QUERY($query1)or die("<blink>BAD NEWS</blink><br>Please email the following to:
<a href=\"mailto:bugcatcher@booksxyz.com?subject=booksxyz.com$PHP_SELF&body=".mysql_error()."\">bugcatcher@booksxyz.com</a><br><br>".mysql_error());

$book_info=mysql_fetch_object($result1);
$number1 = MYSQL_NUM_ROWS($result1);

if($number1>0)
{
$query2 = "SELECT bookID FROM bphotosDB WHERE (bookID = '$book_info->book_id')";
$result2 = MYSQL_QUERY($query2) or die("<blink>BAD NEWS</blink><br>Please email the following to:
<a href=\"mailto:bugcatcher@booksxyz.com?subject=booksxyz.com$PHP_SELF&body=".mysql_error()."\">bugcatcher@booksxyz.com</a><br><br>".mysql_error());

$bphotosDB=mysql_fetch_object($result2);
$number2 = MYSQL_NUMROWS($result2);

if($number2<1)
{
echo"$book_info->book_id insert<br>";

$query = "INSERT INTO bphotosDB (bookID,filename1,plg,psm) VALUES ('$book_info->book_id','$fileisbn','Y','Y')";
$result = MYSQL_QUERY($query) or die("<blink>BAD NEWS</blink><br>Please email the following to:
<a href=\"mailto:bugcatcher@booksxyz.com?subject=booksxyz.com$PHP_SELF&body=".mysql_error()."\">bugcatcher@booksxyz.com</a><br><br>".mysql_error());
}
}
}
fclose ($fd);
?>DONE

I can only read up to 50 photos at a time so it doesn't air out. Does anyone know if there's any binary code(like in C++) that I can use in PHP to make it search through the database faster so it does not air out when I try to read more than 50 photos?

Options: ReplyQuote


Subject
Written By
Posted
Binary codes
July 13, 2005 12:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.