Jump to content

quischen

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

quischen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you, mrdamien. I wanted to do that myself but couldn't seem to figure it out.
  2. Hi, I am attempting to use PHP to search for a list of possible values that must be entered from a text box on a sign up form. However, the user is still allowed to enter other text, as long as he or she also enters one of the predetermined values that I am searching their input for. If the user's input doesn't contain one of the predetermined value, an error message is returned. However, it doesn't seem to work with the multiple "Or" statements. Is there a better way of doing this? I've searched all over the web and on here and I'm still stuck. Here is what I have so far: $string = "Northwestern School Corporation"; //should trigger as true below $newString = ereg_replace("[^A-Za-z0-9]", "", strtolower($string)); //strips spaces out echo $newString."<br />"; //Supposed to match any of the following as true and return the error message. if ( (stristr($newString, 'elementary') === false) || (stristr($newString, 'school') === false) || (stristr($newString, 'middle') === false) || (stristr($newString, 'high') === false) || (stristr($newString, 'college') === false) || (stristr($newString, 'university') === false) ) { echo "Must contain one of the following: Elementary, School, Middle School, High School, College, or University"; } else { //Valid School echo "Valid school."; }
  3. Yes, it is identical. Is there some sort of workaround I can use then if it shouldn't work on either page in order to redirect to another page instead of using the header function to accomplish this task? That is what I am trying to do if the conditions of the logic should it not work.
  4. Yes, I did read the sticky. My issue is that I've got PHP code that works on a server that has an older version of PHP but does NOT work on a server with a newer version of PHP. Also, I am trying to narrow the problem down to whether it is logic related or server related.
  5. Hello, I am having an issue with an php error I am receiving. I have a page that works on an older version of php running on a server which is 4.3.1. However, on another server running php version 4.4.4, that same page returns the following error. Warning: Cannot modify header information - headers already sent by (output started at /home/thegr29/public_html/headerinclude.php:6) in /home/thegr29/public_html/media_videos/retrieve.php on line 315 The page is setup so that there is a header include, a retrieve file, and a video include. The retrieve file checks for a matching city and state and includes the video include file. In the video include file, the matching city and state is then used to load the correct html which will be echoed out to the page. The actual code from line 315 of the retrieve file is: echo "<table width=\"798\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#000000\" bgcolor=\"ffffcc\"> <tr><td width=\"570\" valign=\"top\" bgcolor=\"ffffcc\">"; if ($state == "" || $city =="") { $URL="http://www.kindervision.org"; header("Location: $URL"); } elseif ($state == "VA" && $city =="Richmond-Petersburg" ){ include("videoinclude.php"); echo "</td>"; } else { $URL="http://www.kindervision.org"; header("Location: $URL"); } Also, there is HTML being outputted to the page before the above else statement. Is this the problem? It should be noted that this same file will function correctly on the server with the older version of php (4.3.1) yet will not function on the server with the newer version of php (4.4.4). Any suggestions on how to correct this issue on the new server would be greatly appreciated. Thanks!
  6. That doesn't seem to work either. Could it be something wrong with the logic of the way my PHP page is outputting the results of the SQL query? It is insertting it into a table. This is the only other problem that I could see having an effect on it. I know the query is ugly, I do intend to fix it. It is very much a work in progress. $row_count = 0; //To keep track of row number if (mysql_fetch_assoc($sql_kcnc) > 0) { while($results = mysql_fetch_assoc($sql_kcnc)) { // Decide which colours to alternate for the rows If Remainder of $row_count divided by 2 == 0. $row_color = (($row_count % 2) == 0) ? $colour_even : $colour_odd; echo '<tr bgcolor="' . $row_color . '"> <td width=\"20\"><p>' .$results['count'] . '</p></td> <td width=\"260\"><p>' .$results['url'] . '</p></td> </tr>'; // Increment the row count $row_count++; } } elseif (mysql_fetch_assoc($sql_kcnc) == 0) { echo '<tr> <td colspan=\"2\"><p class=\"red\">No records found</p></td> </tr>'; } // Free the MySQL resource mysql_free_result($sql_kcnc);
  7. Yes. It is returning results for every url inside the IN clause except for the url 'http://kindervision.org/kcnc_the_greatest_save/' .
  8. Hello all, I have an SQL query executing inside a PHP page which retrieves a list of urls through the use of the IN keyword. However, for some reason, one of the urls which is listed in the IN keyword list does not seem to be read into the PHP page. When I execute the same query from my PHP page inside the database's interface, the url missing is returned. My exact SQL code is as follows: $sql_kcnc = mysql_query("SELECT count(*) as count, CASE url WHEN 'http://kindervision.org/kcnc_the_greatest_save/' THEN '<b class=\"red\">KCNC TGS Page</b>' WHEN 'http://kindervision.org/kindiclub/retrieve.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Kindclub Quiz Page</b>' WHEN 'http://kindervision.org/kindiclub/score.php?state=CO&city=Denver' THEN '<b class=\"red\">KCNC Kindclub Score Page</b>' ELSE url END AS url FROM statTracker WHERE url IN('http://kindervision.org/kcnc_the_greatest_save/', 'http://kindervision.org/kindiclub/retrieve.php?state=CO&city=Denver', 'http://kindervision.org/kindiclub/score.php?state=CO&city=Denver', 'http://kindervision.org/wt/wt_retrieve.php?state=CO&city=Denver' ) AND thedate_visited = '$begin_date' GROUP BY url ORDER BY count DESC") or die(mysql_error()); However, the line 'http://kindervision.org/kcnc_the_greatest_save/', does not seem to return any results when there are rows within the database that contain it. How can I fix this line so that it returns data like it should? Note: the query above has been shortened due to size and relevancy since I don't think the rest of the query is at fault. Thank you, Quischen
×
×
  • 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.