Jump to content

xcali

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

xcali's Achievements

Member

Member (2/5)

0

Reputation

  1. PERFECT!!! downloaded "BabelPad" saved in ASCII without BOM, reuploaded the file and it works like a charm!! Thank you so much Wild!!!
  2. I knew you geniuses on here would be able to help me It seems that in my dbconnect I commented out the database name I was pulling data from. and i will definitely change my code to TRIM it Problem solved thank you much! now i gotta figure out the problem with the cookies, from the same code as above, i've added a: ... $row = mysql_fetch_array ($result, MYSQL_NUM); if($row) { //row setcookie('fname', $row[0]); setcookie('lname', $row[1]); //header("Location: calendar.php"); exit(); } //row ... and right off the bat i get the following: Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/r/o/frozensite/html/formlogin.php:1) in /home/content/f/r/o/frozensite/html/formlogin.php on line 27 Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/r/o/frozensite/html/formlogin.php:1) in /home/content/f/r/o/frozensite/html/formlogin.php on line 28 Once again thank you so much for all the help !! I was using the same code a year or 2 ago on a different server and everything worked - now that I moved the files to a new hosting server i keep getting all kinds of errors : /
  3. Hey forum I got an issue I'm trying to fix for the past day and I can't figure out whats wrong. I have a login form that user fills out, hits submit and each time I get the following: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /login.php on line 23 Row #23 is the following: $row = mysql_fetch_array ($result, MYSQL_NUM); Here is the full code: <?php if (isset($_POST['submit'])) { //main require_once ('dbconnect.php'); $errors = array(); if (strlen($_POST['username']) > 0) { $username=$_POST['username']; } else { $errors[] = '<p>You forgot to enter your username!</p>'; } if (strlen($_POST['passwd']) > 0) { $pas=$_POST['passwd']; } else { $errors[] = '<p>You forgot to enter your password!</p>'; } if(empty($errors)) { //empty $query = "SELECT fname, lname FROM tablename WHERE username='$username' AND password='$pas' "; $result = mysql_query($query); $row = mysql_fetch_array ($result, MYSQL_NUM); if($row) { //row ...do whatever } //row else { $errors[] = 'No matches found.'; } } //empty mysql_close(); } //main else { $errors = NULL; } if (!empty($errors)) { echo '<br><p class="error"><b>Following error(s) occured: </b><br />'; foreach ($errors as $msg) { echo " $msg"; } echo '</p><br><p> Letters are <i>Case Sensitive</i>.'; echo '<br> Please <a href="login.php">go back</a> and try again.'; echo '<br> Forgot your password? <a href=fpass.php>Click here</a>.</p>'; } ?>
  4. Hey guys I'm stuck with this problem and i cant seem to solve it Heres the thing: Whenever there are results printed, each available class is printed with the name, date, room and time. What i wanted to do is add a button for each of the rows where if they would click it - the class would be added to their schedule each class has a hidden ID, and i wanted the value of ID be "hidden" in that button and carried to another page when they click it: $data = mysql_query("SELECT class_day, class_time, class_name, room_nr, class_id FROM classinfo WHERE instructor_id='0' and class_name LIKE '%$courses%'"); $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but there aren't any classes avilable at this time<br><br>"; } else { echo "<table align='center' cellspacing='25' cellpadding='1' >"; echo "<tr> <td align='left'><b>Course Name</b></td> <td align='left'><b>Course Date</b></td> <td align='left'><b>Course Time</b></td> <td align='left'><b>Room Nr</b></td> <td align='left'><b>xxxx</b></td>" ; while($result = mysql_fetch_array( $data )) { echo "<tr><td align='left'>" . $result['class_name'] . "</td> <td align='left'>" . $result['class_day'] . "</td> <td align='left'>" . $result['class_time'] . "</td> <td align='left'>" . $result['room_nr'] . "</td> <td align='left'><FORM METHOD='POST' ACTION='addcourse2.php'> <INPUT name=".$result['class_id']." TYPE='submit' VALUE='Add Course'></FORM> </td>"; } echo "</table>"; } } ?> what i have problem with is: <FORM METHOD='POST' ACTION='addcourse2.php'> <INPUT name=".$result['class_id']." TYPE='submit' VALUE='Add Course'></FORM> i want the ".$result['class_id']." to be carried to another page - addcourse2.php, and then addcourse2 to perform a query where it would do something like "insert into blablabla where instructorid=.$result['class_id']" Can i please get some advise on what im doing wrong here Thank you
  5. hey here is a table im using currently if ud like u can modify it and use it ... ... ... $data = mysql_query("SELECT class_day, class_time, class_name, room_nr FROM classinfo WHERE class_name LIKE '%$courses%'"); $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but there aren't any classes avilable at this time<br><br>"; } else { echo "<table align='center' cellspacing='25' cellpadding='1' >"; echo "<tr> <td align='left'><b>Course Name</b></td> <td align='left'><b>Course Date</b></td> <td align='left'><b>Course Time</b></td> <td align='left'><b>Room Nr</b></td> while($result = mysql_fetch_array( $data )) { echo "<tr><td align='left'>" . $result['class_name'] . "</td> <td align='left'>" . $result['class_day'] . "</td> <td align='left'>" . $result['class_time'] . "</td> <td align='left'>" . $result['room_nr'] . "</td> } echo "</table>"; } } ?>
  6. duh works like a charm thank you very much !
  7. Hey guys I have a little problem im trying to solve I was following a "PHP and MYSQL for dynamic websites" book but without success What i am trying to do is after xxxxx results are displayed users get a table like below: what i would like, is for them to be able to click the email and the default mail client opens up and creates new email to the user so i got this: ... ... $anymatches=mysql_num_rows($data); if ($anymatches == 0){ echo "Sorry, but we can not find an entry to match your query<br><br>"; } else{ echo "<table align='center' cellspacing='25' cellpadding='1'>"; echo "<tr> <td align='left'><b>First Name</b></td> <td align='left'><b>Last Name</b></td> <td align='left'><b>Contact</b></td> <td align='left'><b>Age</b></td> <td align='left'><b>Ethnicity</b></td></tr> "; while ($result = mysql_fetch_array($data)) { echo "<tr><td align='left'>" . $result['first_name'] . "</td> <td align='left'>" . $result['last_name'] . "</td> <td align='left'><a href="mailto: . $result['email'] .">" . $result['email'] ."</a></td> <td align='left'>" . $result['age'] . "</td> <td align='left'>" . $result['ethnicity'] . "</td> "; } echo "</table>"; } } now my problem is somewhere in: <td align='left'><a href="mailto: . $result['username'] .">" . $result['username'] ."</a></td> cause i keep getting a blank page whenever i do this may i please get some pointers or suggestion on how to do this correctly? thank you
  8. thank you for the reply i did try it as well as putting single quotes ' instead of " but still same thing :/ heres a screenshot of the cookie and its value as mentioned before id like to have the content of that cookie ( 'I' ) compared to a certain value (in my script 'C') any other ideas what could be wrong? :/
  9. hi again guys once again I'm stuck and i seek some help if possible My problem is this: after the user logs in, cookie is created regis_as and it can have one of 4 values inside: either C, M, I or P now if the user wants to view a certain page, he is redirected to usercheck.php (code below) and there should be a check if the value from the cookie is equal to a certain value so i have this cheap little script <? // check if the info inside cookies is = to a certain value if ($_COOKIE['regis_as'] = 'C')) { //go to some section Header ("Location: browse.php"); } else { // redirect to some other section Header ("Location: uc.php"); } ?> but for some reason it does not redirect the users - i just get a blank page is my whole "($_COOKIE['regis_as'] = 'C'))" suppose to look different or is this just a little mistake i did somewhere? please advise thank you
  10. yes i tried in both internet explorer and Firefox and in both i get the same thing... nothing i cleared everything and logged in - cookie was created and when i view the content, it is exactly what i would like to have displayed I have been trying to to fix this problem for the past 2 days >_<
  11. thank you for your reply same thing - just get Welcome to JDW! any other ideas?
  12. hey guys i have a problem with retrieving information from a cookie the part of my login script creates a cookie with the following: ... // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(username, $_POST['username'], $hour); setcookie(Key_JDW, $_POST['pass'], $hour); ... then a script should retrieve the username from the cookie: the code i use it as follows: <?php echo 'Welcome to JDW' .$_COOKIE['username']. '!'; ?> i only see ' Welcome to JDW! ' Am i doing something wrong? i tried to do " " instead of ' ' i tried both "" '' i tried {$_COOKIE['username']} and such but nothing seems work can it be a problem with the way i created the cookie? edit: i should probably mention that the username they use is their email, when i open the cookie its displayed as "something%40something.com"
  13. dang such an easy thing yet cause so many problems thank you very much guys all works !
  14. thank you for your response thats so weird i tried the code that you supplied but i still keep getting a blank page i also tried replacing "" inside the " " with single quotes as suggested but with the same outcome any other ideas what might be wrong? :s
  15. Hey guys could someone please guide me where im making a mistake? without table everything works find and results are displayed but they are all over the place after creating a table, all i get is a blank page I tried numerous things to fix the problem but i just cant seem to get it :/ Please advise Thank you <?php include('results2.html'); if ($_POST['searching2'] == "yes") { echo '<h1 class="style2">Results</h1><p>'; $gender = $_POST['gender']; $age = $_POST['age']; $btype = $_POST['btype']; $ethnicity = $_POST['ethnicity']; require_once ('../cgi-bin/dbconnect.php'); $data = mysql_query("SELECT * FROM users WHERE regis_as='M' and age='$age' and btype='$btype' and ethnicity='$ethnicity'"); $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } while ($result = mysql_fetch_array($data)) { echo "<table align="center" cellspacing="0" cellpadding="5"> <tr> <td align="left"><b>First Name</b></td> <td align="left"><b>Last Name</b></td> <td align="left"><b>Email</b></td> <td align="left"><b>Age</b></td> <td align="left"><b>Ethnicity</b></td></tr> "; echo "<tr><td align="left">" $result['first_name']"</td> <td align="left">" $result['last_name']"</td></tr> <td align="left">" $result['username']"</td></tr> <td align="left">" $result['age']"</td></tr> <td align="left">" $result['ethnicity']"</td></tr> "; } echo "</table>"; mysql_free_result($result); } ?>
×
×
  • 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.