Jump to content

moselkady

Members
  • Posts

    131
  • Joined

  • Last visited

    Never

Everything posted by moselkady

  1. You needed to declare those passed variables in the function argument list <?php function image_handler($path1, $path2, $path3, $prod_id) { ..... } ?>
  2. it is possible that your $_POST values are already escaped. in that case you do: if (get_magic_quotes_gpc()) { $_POST['email'] = stripslashes($_POST['email']); $_POST['password'] = stripslashes($_POST['password']); }
  3. I don't see any setting for image size in the config file. So, you add the desired size in the first code. For example you can set the image width to 300 pixels and height to 300: <td align=\"center\" nowrap><font size=\"2\" color=\"$dvd_text_color\"><img src=\"$dvd_field_8\" width=\"200\" height=\"200\"></font></td> Not sure if this is what you wanted though
  4. In the last <td> cell replace this <td align=\"center\" nowrap><font size=\"2\" color=\"$dvd_text_color\">$dvd_field_8</font></td> with this: <td align=\"center\" nowrap><font size=\"2\" color=\"$dvd_text_color\"><img src=\"$dvd_field_8\"></font></td>
  5. I may be mistaken but this is what I understand. The form has 'usb' row where the user can enter the cost. I assume that the <INPUT> field for the usb's cost is called "usb_cost". So, the script checks if this field has a value and if it is the script fetches iqid for usb from iqtable then inserts that iqid and the cost into table ctable. We can do the same for avr and usb cable. So the code could be like this: <?php $usb_cost = $_GET['usb_cost']; $usbcable_cost = $_GET['usbcable_cost']; $avr_cost = $_GET['avr_cost']; if ($usb_cost > 0) mysql_query("INSERT INTO ctable (iqid,cost) VALUES((SELECT iqid FROM iqtable WHERE name='usb'),$usb_cost); if ($usbcable_cost > 0) mysql_query("INSERT INTO ctable (iqid,cost) VALUES((SELECT iqid FROM iqtable WHERE name='usb cable'),$usbcable_cost); if ($avr_cost > 0) mysql_query("INSERT INTO ctable (iqid,cost) VALUES((SELECT iqid FROM iqtable WHERE name='avr'),$avr_cost); ?>
  6. I am not sure what the result would look like. If you have sample arrays like this, what would want them to be merged like? $cab_data_t Array ( [0] => Array ( [lob] => cable [tag] => m [count_today] => 10 ) [1] => Array ( [lob] => cable [tag] => m [count_today] => 32 ) ) $cab_data_p Array ( [0] => Array ( [lob] => cable [tag] => m [count_today] => 54 ) [1] => Array ( [lob] => cable [tag] => m [count_today] => 4 ) )
  7. Try something like this: if ($usb_cost > 0) mysql_query("INSERT INTO ctable (iqid,cost) VALUES((SELECT iqid FROM iqtable WHERE name='usb'),$usb_cost);
  8. Can you post a small sample of two of your multi-dimensional arrays and what you want their merged array to look like?
  9. Try this and see if it achieves what you want: $merge = array_merge($array_a, $array_b); print_r($merge);
  10. It appears that your table does not have a field called "username". As a result mysql_query($sql) fails and $result becomes invalid handle and gives the warning error when you use it afterwards. Check your table definition for the "username" field and probably it is misspelled.
  11. Maybe you can print for us your query string as well as any errors from your query. ..... $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; print "$sql<br>"; $result=mysql_query($sql); print mysql_error()."<br>"; .....
  12. Your result will contain the number of rows in table. So to display this number, just add these 2 lines: $row = mysql_fetch_array($result); echo $row[0];
  13. $class = ($cid == 76) ? 'CatLevel2r' : (($cid == 75) ? 'CatLevel2g' : (($cid == 74) ? 'CatLevel2y' : (($cid == 73) ? 'CatLevel2b' : "$MainStyle$SubMenue")));
  14. Add another pair of parenthesis around the second condition $class = ($cid == 76) ? 'CatLevel2r' : (($cid == 75) ? 'CatLevel2g' : "$MainStyle$SubMenue");
  15. <?php $options = array(5, 4, 'updateprofile', 'login', 'register', 'members', 'manage', 'forgot', 'confirm'); if (in_array($_GET['id'], $options)) echo '<p class="block">'; else echo '<p class="block" id="form_box">'; ?> <?php $options = array('2'=>'pages/talltape.php', '3'=>'pages/videos.php', ....); // put the rest of values $id = $_GET['id']; if (array_key_exists($id, $options)) include($options[$id]); else include ('pages/home.php'); ?>
  16. If you select more than one field, the array $row will have their values in the order you put in SELECT statement <?php ...... $query = "SELECT field1, field2, field3 FROM `bookingtable` WHERE `eight` = '-'"; $result = @mysql_query ($query); // Run the query. $row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable. echo $row[0]; // field1 echo $row[1]; // field2 echo $row[2]; // field3 ?> Another thing you code do is user print_r($row) to print all the values in the array and check its structure
  17. try something like if ($_GET['ID'] == 2442) echo file_get_contents("news5.html");
  18. Maybe you can have all your strings in an array and this eliminate the switch block $fields = array("fullname", "email", "cemail", "username", ....); ... ... if ($occurence!=0) { $query.=","; } $query .= $fields[$i]; $query .= "='$info[$i]'"; $occurence=1; } }
  19. In this example I assume that you read your topics from a database. You can change that to fit your setup <php .... $results = mysql_query("SELECT topic FROM mytable ORDER BY topic ASC") $this_topic = ''; echo '<table>'; while ($one_row = mysql_fetch_array($results)) { $topic = $one_row['topic']; $topic_header = ucwords(strmid($topic,0,1)); // check if we have a new topic if ($topic_header != $this_topic) { if ($this_topic != '') echo '</tr>'; $this_topic = $topic_header; echo '<tr colspan=4><td>$this_topic</td></tr><tr>'; $i = 0; } $i++; // if 4 sub-topics already printed, close row and start a new row if ($i == 5) { echo '</tr><tr>'; $i = 1; } echo "<td>$topic</td>"; } echo '</tr></table>'; ?>
  20. I think you have each password:username in a separate line and you read a line-feed inside the string $contents. If this is the case, try something like this <?php $contents = array_map('trim', file($argv[1])); foreach($contents as $line) { list($password, $username) = explode(':', $line); print "$username:$password\n"; } ?>
  21. Try to print mysql_error() after your mysql_query(..) statement to check for errors in it
  22. If it is just 2 number, you can try this: <?php $a = $b = rand(1,12); while ($b == $a) $b=rand(1,12); ?>
  23. It seems that you have only one row in your table as $totalRows_info is equal to 1 and you already fetched that row before you start your HTML part. After that you make a loop to fetch the next rows and display their info, but there are no more rows. I think you should remove this line from the top part of your code.
  24. If your image is in "C:/Apache2.2/htdocs/Jacey/Prod/Laptop/acer1.jpg" and that is exactly what you store in the database, then your code could be like this: <?php $imageurl = str_replace("C:/Apache2.2/htdocs", "", $row['product_image']) ?> <p><img src="<?php echo $imageurl; ?>" /> This way your <img> is <img src="/Jacey/Prod/Laptop/acer1.jpg">
×
×
  • 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.