Jump to content

Firemankurt

Members
  • Posts

    56
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://iaff106.org
  • Yahoo
    firemankurt

Profile Information

  • Gender
    Male
  • Location
    Washington State

Firemankurt's Achievements

Member

Member (2/5)

1

Reputation

  1. if you add var_dump(file); at the end of your script does it show any values in "file" array?
  2. 1 - I'm guesing you are not actually connected to MySQL database before calling [b]mysql_real_escape_string ()[/b] somewhere (looks like file is :  [b]connect.php[/b] on line 30) [i]string[/i] mysql_real_escape_string ( [i]string[/i] unescaped_string[i] [, resource link_identifier][/i] ) 2 - maybe your script is putting a boolean  value in place of the optional [u]resource link_identifier[/u]. I'm not sure why you believe the problem is in the code you posted???
  3. You could query the columns info and then use the results to set the values in a form. Here is a start point: from: [url=http://dev.mysql.com/doc/refman/5.0/en/describe.html]http://dev.mysql.com/doc/refman/5.0/en/describe.html[/url] DESCRIBE provides information about the columns in a table. It is a shortcut for SHOW COLUMNS FROM. As of MySQL 5.0.1, these statements also display information for views. (See Section 13.5.4.3, “SHOW COLUMNS Syntax”.) col_name can be a column name, or a string containing the SQL ‘%’ and ‘_’ wildcard characters to obtain output only for the columns with names matching the string. There is no need to enclose the string within quotes unless it contains spaces or other special characters. [code] mysql> DESCRIBE city; +------------+----------+------+-----+---------+----------------+ | Field      | Type    | Null | Key | Default | Extra          | +------------+----------+------+-----+---------+----------------+ | Id        | int(11)  | NO  | PRI | NULL    | auto_increment | | Name      | char(35) | NO  |    |        |                | | Country    | char(3)  | NO  | UNI |        |                | | District  | char(20) | YES  | MUL |        |                | | Population | int(11)  | NO  |    | 0      |                | +------------+----------+------+-----+---------+----------------+[/code]
  4. I have seen a few projects like this on sourceforge. You might search around like: [url=http://sourceforge.net/search/?type_of_search=soft&words=school]http://sourceforge.net/search/?type_of_search=soft&words=school[/url] You might get ideas or just use something you find there.
  5. If you want to do this after the query then something like: [code] <?php $mystring = 'This is a long block of usles text <!stop> that goes on forever.'; $findme  = '<!stop>'; $pos = strpos($mystring, $findme); $ShortStr = substr($mystring, 0, $pos); echo $ShortStr; ?> [/code]
  6. [code] <?php $result = mysql_query("SELECT clients_name, id FROM clients_info WHERE city='$city' AND $category='x'group by clients_name"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {   $filename="/data/11/0/77/86/729738/user/744719/htdocs/b/admin/client_pics/$row[1]/";   if (file_exists($filename))   {     $dir = "/data/11/0/77/86/729738/user/744719/htdocs/b/admin/client_pics/$row[1]/";     $dh  = opendir($dir);     while (false !== ($filename = readdir($dh)))     { //      $files[]=$filename;  ---- Remove this ----     $Exten = substr($filename, -3);     if ($Exten=="jpg" || $Exten=="gif") $files[]=$filename;       //echo "filename: $filename : filetype: " . filetype($dir . $filename) . "\n";     }   $PicCount = count($files); // Count number of files found   } if ($PicCount >2)// this is how you know there are pics and not just directories   {     $PictNum = rand(2, $PicCount); // choose random picture     print "<TR><TD><img src=/phpThumb/phpThumb.php?src=/b/admin/client_pics/$row[1]/$files[$PictNum]&w=100>/b/admin/client_pics/$row[1]/$files[$PictNum]</TD></TR>";   }   else {       echo "This client has no pictures";   } [/code]
  7. How about: [code]       $ImageSet = $num_rows / 20;       $total_pages = round($ImageSet);       if ($ImageSet > $total_pages) ++$total_pages;   }   if ($current_page == 1) {       $Limit_finish = 20*$current_page;       $Limit_start = $page_finish-20;   } [/code]
  8. Her try this: [code]     $query_add_product_range = "INSERT INTO TestP ( product_id, product_category, product_title, product_name, product_code, product_quantity_description, product_weight, product_price, product_dangerous ) VALUES ( $product_id, $product_category, $product_title, $product_name, $product_code, $product_quantity, $product_weight, $product_price, $product_dangerous )"; [/code]
  9. <?php // Query above already done echo "<div align=\"center\">   <table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" bordercolordark=\"#000000\" bordercolorlight=\"#000000\">"; $i = 0; echo "<tr>\n"; while ($a_row= mysql_fetch_row($Result)){   if($i == 4) { echo "<tr>\n"; $i = 0; } echo"<td width=\"100\">         <div align=\"center\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\">"; if (file_exists("$abpath/path to image/$a_row[id]-top.jpg")) { echo("<img src=\"http://$domain/path to image/$a_row[id]-top.jpg\" width=\"100\"><br>$a_row[#####]</td>"); $i++; } } echo "</table>"; // More php... ?>
  10. Couple simple things to help find your problem add this while debuging: [code] var_dump($_POST); ... mysql_select_db($db) or die(mysql_error()); mysql_query("INSERT INTO 'guides' VALUES ('$title','$summary','$screenshot','$content','$overallrating','$media','$gameplay','$graphics','$sound','$value')"); $ErrNum = mysql_errno (); $ErrText  = mysql_error(); echo "Error : ".$ErrNum."  ".$ErrText; Print "Your information has been successfully added to the database."; [/code] Then you can see what was recieved in the post and then see any MySQL errors.
  11. I am not sure what you are after but I know you can include html pages into php pages like: [code] <html> <head> </head> <body> <?php echo "some PHP content"; ?> <IFRAME SRC="recipe.html" TITLE="The Famous Recipe"> <!-- Alternate content for non-supporting browsers --> <H2>The Famous Recipe</H2> <H3>Ingredients</H3> .... </IFRAME> </body> </html> [/code] You would save this as a php file. You could also insert php into an html page like: HtmlPageWithPhpInside.htm [code] <html> <head> </head> <body> <?php echo "some PHP content"; ?> html... blah... blah... </body> </html> [/code] and then include this in a php doc. New.php [code] <?php include ('HtmlPageWithPhpInside.htm'); ?> [/code] Anyway... If you give me more info I can see if there is more I can help with.
  12. You could echo some variables to help find the problem: [code]... print "<TR><TD><img src=/bella/admin/client_pics/$row[1]/$files[$PictNum]><br/>/bella/admin/client_pics/$row[1]/$files[$PictNum]</TD></TR>"; ...[/code] Might also want to check substring of $filename to see if it ends in ".jpg" or ".gif" before you actually print it. [code]... {     $Exten = substr($filename, -3);     if ($Exten=="jpg" || $Exten=="gif") $files[]=$filename;       //echo "filename: $filename : filetype: " . filetype($dir . $filename) . "\n";     } ...[/code]
  13. You also need to change the way you test for existing pictures: [code] <?php $result = mysql_query("SELECT clients_name, id FROM clients_info WHERE city='$city' AND $category='x'group by clients_name"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {   $filename="/data/11/0/77/86/729738/user/744719/htdocs/bella/admin/client_pics/$row[1]/";   if (file_exists($filename))   {     $dir = "/data/11/0/77/86/729738/user/744719/htdocs/bella/admin/client_pics/$row[1]/";     $dh  = opendir($dir);     while (false !== ($filename = readdir($dh)))     {       $files[]=$filename;       //echo "filename: $filename : filetype: " . filetype($dir . $filename) . "\n";     }   $PicCount = count($files); // Count number of files found   } if ($PicCount >2)// this is how you know there are pics and not just directories   {     $PictNum = rand(2, $PicCount); // choose random picture     print "<TR><TD><img src=/bella/admin/client_pics/$row[1]/$files[$PictNum]></TD></TR>";   }   else {       echo "This client has no pictures";   }   print("<TR><TD><center>"); /*    <img src=/phpThumb/phpThumb.php?src=/bella/admin/client_pics/$row[1]/$files[2]&w=100></br> */     print ("<a href=view_profile.php?id=$row[1] target=frame3>$row[0]</a></br></TD></TR>"); unset($files); // Clear previous users pictures } clearstatcache (); mysql_free_result($result); ?> [/code]
  14. How about this : [code] <?php $result = mysql_query("SELECT clients_name, id FROM clients_info WHERE city='$city' AND $category='x'group by clients_name"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) {   $filename="/data/11/0/77/86/729738/user/744719/htdocs/bella/admin/client_pics/$row[1]/";   if (file_exists($filename))   {     $dir = "/data/11/0/77/86/729738/user/744719/htdocs/bella/admin/client_pics/$row[1]/";     $dh  = opendir($dir);     while (false !== ($filename = readdir($dh)))     {       $files[]=$filename;       //echo "filename: $filename : filetype: " . filetype($dir . $filename) . "\n";     }     $PictNum = rand(2, count($files)); // choose random picture     print "<TR><TD><img src=/bella/admin/client_pics/$row[1]/$files[$PictNum]></TD></TR>";   }   else {       echo "This client has no pictures";   }   print("<TR><TD><center>"); /*    <img src=/phpThumb/phpThumb.php?src=/bella/admin/client_pics/$row[1]/$files[2]&w=100></br> */     print ("<a href=view_profile.php?id=$row[1] target=frame3>$row[0]</a></br></TD></TR>"); unset($files); // Clear previous users pictures } clearstatcache (); mysql_free_result($result); ?>[/code] Your wer not clearing previous users pics
×
×
  • 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.