Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Does the mysql_* functions work fine in a standalone script: eg: <?php echo 'Connecting to MySQL server...'; mysql_connect('localhost', 'root', '') or die(' FAILURE!<br />Error: ' . mysql_error()); echo ' SUCCESS!<br />'; echo 'Selecting \'mysql\' Database...'; mysql_select_db('mysql') r die(' FAILURE!<br />Error: ' . mysql_error()); echo 'SUCCESS!<br />MySQL extension is loaded and working fine'; ?> If the above code display errors, such as undefined function mysql_connect, or all you get is Connecting to MySQL server... and nothing else is displayed then the mysql extension is not loaded. There could be many reasons why this could be. The first thing to do is to see of PHP is actually using the php.ini that you are edting, to test this simply run the phpinfo() function within a script, then run the script. Next Search for a line that starts with Loaded Configuration File. To the right of that line will be the full path to the php.ini PHP has loaded for configuration. If no path is stated then PHP is not reading the php.ini you are editing and thus PHPMyAdmin is displaying the above error. To fix this, do as PFMaBiSmAd said, add PHP to the PATH Environment Variable. After doing this restart Windows. After Windows has booted rerun the phpinfo script and check to see if the php.ini has loaded. Also avoid moving files outside of the PHP installation folder, this can cause more problems then needs be - especially when you upgrade PHP later on.
  2. Maybe ask the dev folks at firefox, it is open source so you could just download the source code and have a browse through the code. As this is not related to Apache, I'll move this.
  3. What versions of Apache/PHP have you installed. Also how are you installing Apache/PHP. When installing PHP avoid the installer, just download the zipped binaries package. PHP does not really require an installer. Also when installing Apache/PHP/MySQL it is recommended to avoid using spaces in file paths.
  4. The error refers to how PHP is configured. It has nothing to do with phpMyAdmin or MySQL.
  5. When defining a query you need to wrap it in quotes. mysql_query("UPDATE ghetto_cron SET total_runs = total_runs + 1 WHERE game = '$game' AND id = '{$getMonthlyCron['id']}'");
  6. phpmyadmin handles this for you. Follow the steps in this post.
  7. This is all handled by the web browser itself. There is no HTTP protocol that exists which tells the browser how to load a page in a new window/tab.
  8. It would be better if you added LIMIT 4 to the end of your query. This way rather than MySQL having to return all rows which are active, it'll just return 4 results. I'd then use this code: $sql1 = "SELECT * FROM mytable where active='yes' LIMIT 4"; $result1 = mysql_query($sql1); while($rows1 = mysql_fetch_array($result1)) { $id[] = $rows1['id']; } if(is_array($id)) { $sql2 = "UPDATE mytable SET active='no' WHERE id IN(" . implode(',', $id) . ')'; mysql_query($sql2); }
  9. When using the $_POST vars, you place the name of the form field within the square brackets (wrapped in quotes). So the following variable $_POST['email'] will refer to a form field named email. So retrieve the value from the form field called element_1_1 you'd use $_POST['element_1_1']
  10. Look in to sending emails with the mail() function. As for processing form data there are many tutorials on using $_GET/$_POST variables.
  11. It most probably to do with how your server is configured rather than PHP. As CV said if PHP was still processing the script you'll just get a blank page. PHP does not outpot data a bit a time. The following script proves this: echo 'Hello'; sleep('2'); // sleep for 2 secounds echo ' world'; If you ran that PHP will outut 'Hello world' after two seconds has passed. It wont output Hello and then world 2 seconds after.
  12. Could you explain fully what you're trying to do? I find the following code difficult to understand: $count='4'; $id[]=$rows1['id']; for($i=0;$i<$count;$i++){ $sql2="UPDATE mytable SET active='no' WHERE id='$id[$i]'"; $result2=mysql_query($sql2); Specifically the $id[]=$rows1['id'] line. $rows1['id'] will return a non array value (I presume a number), however you're adding the value of $row['id'] to the $id[] array. Then next your telling PHP to run the code within the for loop 4 times, which iterates through the the $id array. << This happens everytime PHP loops through the while loop. I am not surprised why you're getting the notices. As most of the time keys 2 and 3 will not be set.
  13. Looking at your code, it is actually simple to fix. All you need to do is change the $order and $offset variables to $_GET['order'] and $_GET['offset'] respectively, The same applies for the $search_string and $search_type variables except you'll want to change them to $_REQEST['search_string'] and $_REQUEST['search_type'] instead. Untested code: <?php include_once "db_mysql.inc"; $q = new DB_Sql; $s = new DB_Sql; $limit_records = 50; // Get users group contacts list // Set the sql order $cont_order = 'Surname'; if(isset($_GET['order'])) { switch($_GET['order']) { case "name_up": $cont_order = 'Surname'; break; case "name_dn": $cont_order = 'Surname DESC'; break; case "town_up": $cont_order = 'Town,Surname'; break; case "town_dn": $cont_order = 'Town DESC,Surname'; break; case "county_up": $cont_order = 'County,Surname'; break; case "county_dn": $cont_order = 'County DESC,Surname'; break; default: $cont_order = 'Surname'; break; } } // Set the crtieria if (isset($_REQUEST['search_string']) && !empty($_REQUEST['search_string'])) { $search_string = mysql_real_escape_string($_REQUEST['search_string']); $search_type = $_REQUEST['search_type']; switch($search_type) { case "Surname": $where = ' WHERE Surname LIKE "'.$search_string.'%" '; break; case "Town": $where = ' WHERE Town LIKE "'.$search_string.'%" '; break; case "County": $where = ' WHERE County LIKE "'.$search_string.'%" '; break; } } // Get total records for query $sql = "SELECT COUNT(Name) AS count FROM diarylst $where"; $q->query($sql); $q->next_record(); $count = $q->f('count'); if(!isset($_GET['offset']) && is_numeric($_GET['offset'])) $offset = 0; // start point for LIMIT statement // Get the required records $sql = "SELECT * FROM diarylst $where ORDER BY $cont_order LIMIT $offset, $limit_records "; /* $sql = "SELECT CONCAT(cont_firstname,' ',cont_lastname) AS cont_name, contacts.*,comp_name,comp_tel1,comp_fax FROM contacts,company WHERE (comp_id = cont_comp_id) AND cont_personal = '0' ORDER BY $cont_order LIMIT $offset, $limit_records"; */ $q->query($sql); // record limit controls $records_to = (($offset + $limit_records) > $count)? $count : ($offset + $limit_records); $message = "[Records ".($offset + 1)." to ".$records_to." of ".$count."]"; $next = ($count > $offset + $limit_records)? ($offset + $limit_records) : 0; $previous = $offset - $limit_records ; $rem = ($count%$limit_records == 0)? $limit_records : $count%$limit_records; // Records on last page $last = $count - $rem; if($previous >= 0) { $first_set = '<a href="'.$_SERVER['PHP_SELF'].'?offset=0&order='.$order.'&search_string='.$search_string.'&search_type='.$search_type.'"><img src="./common/point_start_dk.gif" width="20" height="15" alt="First page" border="0"></a>'; }else{ $first_set = '<img src="./common/point_start_lt.gif" width="20" height="15" alt="No previous records" border="0">'; } if($next) { $next_set = '<a href="'.$_SERVER['PHP_SELF'].'?offset='.$next.'&order='.$order.'&search_string='.$search_string.'&search_type='.$search_type.'"><img src="./common/point_right_dk.gif" width="20" height="15" alt="Next page" border="0"></a>'; }else{ $next_set = '<img src="./common/point_right_lt.gif" width="20" height="15" alt="No more contacts" border="0">'; } if($previous >= 0) { $previous_set = '<a href="'.$_SERVER['PHP_SELF'].'?offset='.$previous.'&order='.$order.'&search_string='.$search_string.'&search_type='.$search_type.'"><img src="./common/point_left_dk.gif" width="20" height="15" alt="Previous page" border="0"></a>'; }else{ $previous_set = '<img src="./common/point_left_lt.gif" width="20" height="15" alt="No previous records" border="0">'; } if($next) { $last_set = '<a href="'.$_SERVER['PHP_SELF'].'?offset='.$last.'&order='.$order.'&search_string='.$search_string.'&search_type='.$search_type.'"><img src="./common/point_end_dk.gif" width="20" height="15" alt="Final page" border="0"></a>'; }else{ $last_set = '<img src="./common/point_end_lt.gif" width="20" height="15" alt="No more contacts" border="0">'; } ?> <html> <head> <title>ALCD: Existing Members List</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="alcd.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/JavaScript"> <!-- var winOpened = null; function openCustomWindow(goto) { winOpened = window.open(goto,'winDetails','toolbar=no,status=yes,menubar=no,width=350,height=400'); } function winLink(goto) { if (winOpened && winOpened.open && !winOpened.closed) { locArray = winOpened.location.href.split("/"); if(locArray[locArray.length - 1] != goto){ winOpened.location.href=goto; } winOpened.focus(); }else{ openCustomWindow(goto); } } //--> </script> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table width="759" border="0" cellspacing="0" cellpadding="0" class="stdText"> <tr> <td align="left" valign="middle" bgcolor="#FFFFFF"> </td> <td colspan="6" align="left" valign="top" bgcolor="#FFFFFF"><br> A = Associate<br> F = Fellow<br> FCL = Fellow Costs Lawyer<br><br> <form name="form1" method="post" action="<? print $_SERVER['PHP_SELF'] ?>"> Search <font size="1">(all or part of name)</font> <input name="search_string" type="text" id="search_string" size="20"> <input name="search_type" type="radio" value="Surname" checked> Surname <input type="radio" name="search_type" value="Town"> Town <input type="radio" name="search_type" value="County"> County <input type="submit" name="Submit" value="Submit"> </form> </td> </tr> <tr> <td align="left" valign="middle" bgcolor="#FFFFFF"> </td> <td align="left" valign="middle" bgcolor="#FFFFFF"><? print "$first_set$previous_set$next_set$last_set" ?></td> <td align="left" valign="middle" bgcolor="#FFFFFF"> </td> <td bgcolor="#FFFFFF" colspan="4"><font size="1"><? print $message ?></font></td> </tr> <tr> <td> </td> <td><br><Br><a href="<? print $_SERVER['PHP_SELF'] ?>?order=name_up"><img src="./common/point_up.gif" width="20" height="15" border="0" alt="Order by Name Ascending"></a><a href="<? print $_SERVER['PHP_SELF'] ?>?order=name_dn"><img src="./common/point_dn.gif" width="20" height="15" border="0" alt="Order by Name Descending"></a><strong>Name</strong></td> <td><Br><br><a href="<? print $_SERVER['PHP_SELF'] ?>?order=town_up"><img src="./common/point_up.gif" width="20" height="15" border="0" alt="Order by Town Ascending"></a><a href="<? print $_SERVER['PHP_SELF'] ?>?order=town_dn"><img src="./common/point_dn.gif" width="20" height="15" border="0" alt="Order by Town Descending"></a><strong>Town</strong></td> <td><Br><br><a href="<? print $_SERVER['PHP_SELF'] ?>?order=county_up"><img src="./common/point_up.gif" width="20" height="15" border="0" alt="Order by County Ascending"></a><a href="<? print $_SERVER['PHP_SELF'] ?>?order=county_dn"><img src="./common/point_dn.gif" width="20" height="15" border="0" alt="Order by County Descending"></a><strong>County</strong></td> <td align="center" valign="top"><strong><Br><br>Status</strong></td> <td align="center" valign="top"><strong><br><Br>Details</strong></td> <td width="9" align="center" valign="top"> </td> </tr> <? while ($q->next_record()) { ?> <tr> <td align="left" valign="top" class="a2<? echo $class_done ?>"> </td> <td align="left" valign="top" class="a2<? echo $class_done ?>"> <? $q->p("Name") ?> </td> <td align="left" valign="top" class="a2<? echo $class_done ?>"> <? $q->p("Town") ?> </td> <td align="left" valign="top"> <? $q->p("County") ?> </td> <td align = "center" valign="top"> <? $q->p("Status") ?> </td> <td align = "center" valign="top"><a href="javascript:winLink('popup_details.php?id=<? urlencode($q->p('Name')) ?>')"><img src="./common/pencil.gif" width="20" height="15" alt="<? print $details ?>" border="0"></a></td> <td align = "center" valign="top"> </td> </tr> <? } ?> <tr> <td width="84" align="left" valign="top" class="a2<? echo $class_done ?>"> </td> <td width="239" align="left" valign="top" class="a2<? echo $class_done ?>"> </td> <td width="147" align="left" valign="top" class="a2<? echo $class_done ?>"> </td> <td width="148" align="left" valign="top"> </td> <td width="55" align = "center" valign="top"> </td> <td width="77" align = "center" valign="top"> </td> <td align = "center" valign="top"> </td> </tr> <tr> <td colspan="7"> </td> </tr> </table> </body> </html>
  14. Dont you mean $_GET['fieldID'] not $_GET['$fieldID']
  15. Assuming you're using Crayon Violent's code, change: print "\t<td><font face=arial size=2 color=$color1/>{$get_info[0]}</font><br />"; To print "\t<td><img src=\"your_image_path_here\"><font face=arial size=2 color=$color1/>{$get_info[0]}</font><br />";
  16. Do you have Skype installed by chance? If you do Skype will interfere with Apache, as both Apache and Skype will use port 80. You'll need to configure apache to use a different port eg 8080 instead. Ports cannot be shared simultaneously. Going to http://localhost/ should not go to your router configuration page. To change the port Apache uses open the httpd.cond and change Listen 80 to Listen 8080 Save the httpd.conf. Now Start Apache. if it starts up go to http://localhost:8080/ rather than http://localhost/
  17. On some settings PHP will automatically configure itself, if no configuration for a particular setting is set within the php.ini. PHP will have built in default settings. It will also inherit some settings from the system. Whatever you set in the php.ini will override the default setting.
  18. What addresses are you using? If Apache is installed on the same computer as the one you're using then use http://localhost/ not your routers ip address. Also when you install Apache make sure you set the network domain and Server name to localhost too.
  19. You can either apply the bullet point as a background image for the quotes cell, or use the <img> tag instead.
  20. I'm not following you there. Could you explain a little more. I cannot see why you need to use <br /> to separate the quotes. They are contained in individual table cells. If you want to space things out a little apply some cellpadding to the table tag, eg print "<table width=200 border=0 cellpadding=5>\n";
  21. Something like: <?php $database = "****"; mysql_connect ("localhost", "****", "****"); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query( "SELECT quote, source FROM movies" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "<table width=\"200\" border=\"0\">\n"; // initiate counter $i = 0; // colors array // two colors red and pink // RED PINK $colors = array('#FF0000', '#FF0099'); // loop through results, on each iteration the color of the text will alternate between red and pink while ($get_info = mysql_fetch_row($result)) { // Here we work out which color to use for the text $color = ($i%2 == 0) ? $colors[0] : $colors[1]; // The above line of code uses the modulos operator %. // This operator returns the remainder of a divison. // So the above code goes like this: // IF the remainder of the sum ($i DIVIDE BY 2) is EQUALS TO ZERO // THEN set the text color to RED // ELSE set the text color to PINK print "<tr>\n"; foreach ($get_info as $field) // Try to avioud using <font> tags they are depreciated. Use CSS instead. print "\t<td><span style=\"font-family: Arial; font-size: 14px; color:{$color};\">$field</span></td>\n"; print "</tr>\n"; } print "</table>\n"; ?>
  22. Can you most the whole contents of alerts.php Also can you provide information on how you use alerts.php? Is it being included in other scripts etc?
  23. Does the index.php file load if you go to http://localhost/index.php if it does try clearing your browsers cache and then try going to http://localhost/ Also make sure you have renamed index.html to to index1.html before testing. For now I say stick with what you have got. It is far more intuitive to learn how AMP is set up.
  24. You need to edit phpMyAdmins configuration. Look for a file called config.inc.php within phpmyadmins folder. Find the following line: $cfg['Servers'][$i]['auth_type'] = 'config' Change config to http Also add // infront of the $cfg['Servers'][$i]['username'] and $cfg['Servers'][$i]['password'] lines too. Save the config.inc.php file. PHPMyAdmin has now been configured to prompt for a username/password when you access http://localhost/phpmyadmin/
  25. Check to make sure the variable you're passing to forearch is an array by using the is_array() function. if(is_array($array_var)) { foreach($arrar_var as $whatever) { // do something } }
×
×
  • 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.