
csteff24
Members-
Posts
34 -
Joined
-
Last visited
Never
Everything posted by csteff24
-
Thank you! I'm not familiar with either of those methods, so sorry if I'm not making sense! CREATE TABLE `members` ( `id` int(4) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `password` varchar(65) NOT NULL default '', `club` int(3) NOT NULL, `perm` tinyint(1) NOT NULL, `email` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=412 ; So in order to add the | to users with multiple clubs, do I have to go through manually, or can I do it an easier way?
-
Right now I have a database that has a user field and a field for the ID of the club that they are advisor of The problem is that some people advise multiple clubs Right now I have them listed as seperate usernames For example: Username - ID - Password - Club John_Doe - 24 - password - 32 John_Does - 87 - password - 16 However, this causes problems when they log in - it turns into an infinite loop of some sort since there's two different users created with this same username Also, I have the name of their club show up using the Club ID, but if they have two clubs, how can I make both show up? Thank you! Let me know if this doesn't make sense...
-
would using $SESSION_ be better than $COOKIE_ then? I'm just wondering if I do if ($_COOKIE['ID_staples_clubs'] == 'user') { $delete = "delete";} else {$delete = "";} isn't the 'user' that I'm comparing to the cookie just the word user? How do I compare it to the user that's stored?
-
Oh, thank you! It's not coming up, though. I don't think I can compare the cookie to 'user', because I want to compare it to the user field in my database, not just the string "user" $getEvent_sql = "SELECT id, event_title, event_shortdesc, user, date_format(event_start, '%I:%i %p') AS fmt_date FROM calendar_events WHERE month(event_start) = '".$m."' AND dayofmonth(event_start) = '".$d."' AND year(event_start) = '".$y."' ORDER BY event_start"; $getEvent_res = mysqli_query($mysqli, $getEvent_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($getEvent_res) > 0) { if ($_COOKIE['ID_staples_clubs'] == 'user') { $delete = "delete";} else {$delete = "";} $event_txt = "<ul>"; while ($ev = mysqli_fetch_array($getEvent_res)) { $event_title = stripslashes($ev["event_title"]); $event_shortdesc = stripslashes($ev["event_shortdesc"]); $id = $ev['id']; $fmt_date = $ev["fmt_date"]; $event_txt .= "<li><strong>".$fmt_date."</strong>: ".$event_title."</br>".$event_shortdesc."<br/>".$delete."</li>"; } $event_txt .= "</ul>"; mysqli_free_result($getEvent_res); } else { $event_txt = ""; }
-
Am I trying to match the user correctly?
-
Oh, good idea To match the user, I tried doing: if ($_COOKIE['ID_staples_clubs'] = 'user') { $delete = " ????";} else {$delete = "";} So if I have the username stored as a cookie, shouldn't ???? come up only if I'm logged in as the user who added the event? Because right now it's coming up no matter what.
-
anybody? haha
-
I have a calendar that users can add events to. When a user adds an event, it is displayed under "Today's Events" and the user that added it is saved in the calendar_events table under the user field for that event I'm trying to allow users to delete their events, but I'm not sure exactly what to do... here's the part that I'm having problems with...I know I should create a link to a delete.php file, but how would I call on the id of the event in that link? Also, right now the delete is coming up for every event, not just the ones which the user created if ($_COOKIE['ID_staples_clubs'] = 'user') { $delete = " ????";} else {$delete = "";} $event_txt .= "<li><strong>".$fmt_date."</strong>: ".$event_title."</br>".$event_shortdesc."<br/>".$delete."</li>"; } $event_txt .= "</ul>"; <html> <head> <title>Show/Add Events</title> </head> <body> <h1>Show/Add Events</h1> <?php $mysqli = mysqli_connect ------; //add new event if ($_POST) { $m = $_POST["m"]; $d = $_POST["d"]; $y = $_POST["y"]; $event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].":".$_POST["event_time_mm"].":00"; $insEvent_sql = "INSERT INTO calendar_events (event_title, event_shortdesc, event_start, user) VALUES ('".$_POST["event_title"]."', '".$_POST["event_shortdesc"]."', '$event_date','".$_COOKIE['ID_staples_clubs']."')"; $insEvent_res = mysqli_query($mysqli, $insEvent_sql) or die(mysqli_error($mysqli)); } else { $m = $_GET["m"]; $d = $_GET["d"]; $y = $_GET["y"]; } //show events $getEvent_sql = "SELECT event_title, event_shortdesc, date_format(event_start, '%I:%i %p') AS fmt_date FROM calendar_events WHERE month(event_start) = '".$m."' AND dayofmonth(event_start) = '".$d."' AND year(event_start) = '".$y."' ORDER BY event_start"; $getEvent_res = mysqli_query($mysqli, $getEvent_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($getEvent_res) > 0) { $event_txt = "<ul>"; while ($ev = mysqli_fetch_array($getEvent_res)) { $event_title = stripslashes($ev["event_title"]); $event_shortdesc = stripslashes($ev["event_shortdesc"]); $fmt_date = $ev["fmt_date"]; if ($_COOKIE['ID_staples_clubs'] = 'user') { $delete = " ????";} else {$delete = "";} $event_txt .= "<li><strong>".$fmt_date."</strong>: ".$event_title."</br>".$event_shortdesc."<br/>".$delete."</li>"; } $event_txt .= "</ul>"; mysqli_free_result($getEvent_res); } else { $event_txt = ""; } mysqli_close($mysqli); if ($event_txt != "") { echo "<p><strong>Today's Events:</strong></p> $event_txt <hr/>"; } if(isset($_COOKIE['ID_staples_clubs']) && isset($_COOKIE['Key_staples_clubs'])) { //show form echo " <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\"> <p><strong>Would you like to add an event?</strong><br/> Complete the form below and press the submit button to add an event</p> <p><strong>Event Title:</strong><br/> <input type=\"text\" name=\"event_title\" size=\"25\" maxlength=\"25\" /> <p><strong>Event Description:</strong><br/> <input type=\"text\" name=\"event_shortdesc\" size=\"25\" maxlength=\"255\" /> <p><strong>Event Time (hh:mm):</strong><br/> <select name=\"event_time_hh\"> <option value=\"0\">12AM</option> <option value=\"1\">1AM</option> <option value=\"2\">2AM</option> <option value=\"3\">3AM</option> <option value=\"4\">4AM</option> <option value=\"5\">5AM</option> <option value=\"6\">6AM</option> <option value=\"7\">7AM</option> <option value=\"8\">8AM</option> <option value=\"9\">9AM</option> <option value=\"10\">10PM</option> <option value=\"11\">11PM</option> <option value=\"12\">12PM</option> <option value=\"13\">1PM</option> <option value=\"14\">2PM</option> <option value=\"15\">3PM</option> <option value=\"16\">4PM</option> <option value=\"17\">5PM</option> <option value=\"18\">6PM</option> <option value=\"19\">7PM</option> <option value=\"20\">8PM</option> <option value=\"21\">9PM</option> <option value=\"22\">10PM</option> <option value=\"23\">11PM</option> </select> : <input type=\"text\" name=\"event_time_mm\" size=\"2\" maxlength=\"2\" /> <input type=\"hidden\" name=\"m\" value=\"".$m."\"> <input type=\"hidden\" name=\"d\" value=\"".$d."\"> <input type=\"hidden\" name=\"y\" value=\"".$y."\"> <br/><br/> <input type=\"submit\" name=\"submit\" value=\"Add Event\"> </form>"; } ?> </body> </html> Thanks!
-
I have a calendar that allows users to create events - However, if a specific date has multiple events, it only shows one How can I get them to all show up? preferably as a list... <?php ... define("ADAY", (60*60*24)); if ((!isset($_POST["month"])) || (!isset($_POST["year"]))) { $nowArray = getdate(); $month = $nowArray["mon"]; $year = $nowArray["year"]; } else { $month = $_POST["month"]; $year = $_POST["year"]; } $start = mktime (12, 0, 0, $month, 1, $year); $firstDayArray = getdate($start); ?> <html> <head> <title><?php echo "Calendar: ".$firstDayArray["month"]." ".$firstDayArray["year"]; ?></title> <script type="text/javascript"> function eventWindow(url) { event_popupWin = window.open(url, 'event', 'resizeable=yes, scrollbars=yes, toolbar=no, width=400, height=400'); event_popupWin.opener = self; } </script> <head> <body> <h1>Select a Month/Year Combination</h1> <form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>"> <select name="month"> <?php $months = Array("January","February","March","April","May","June","July","August","September","October","November","December"); for ($x=1; $x <= count($months); $x++) { echo"<option value=\"$x\""; if ($x == $month) { echo " selected"; } echo ">".$months[$x - 1]."</option>"; } ?> </select> <select name="year"> <?php for ($x=2009; $x<=2015; $x++) { echo"<option"; if ($x == $year) { echo " selected"; } echo ">$x</option>"; } ?> </select> <input type="submit" name="submit" value="Go!"> </form> <br /> <?php $days = Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); echo "<table border=\"1\" cellpadding=\"5\"><tr>\n"; foreach ($days as $day) { echo "<td style=\"background-color: #CCCCCC; text-align: center; width: 14%\"><strong>$day</strong></td>\n"; } for ($count=0; $count < (6*7); $count++) { $dayArray = getdate($start); if (($count % 7) == 0) { if ($dayArray["mon"] != $month) { break; } else { echo "</tr><tr>\n"; } } if ($count < $firstDayArray["wday"] || $dayArray["mon"] != $month) { echo "<td> </td>\n"; } else { $chkEvent_sql = "SELECT event_title FROM calendar_events WHERE month(event_start) = '".$month."' AND dayofmonth(event_start) = '".$dayArray["mday"]."' AND year(event_start) = '".$year."' ORDER BY event_start"; $chkEvent_res = mysqli_query($mysqli, $chkEvent_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($chkEvent_res) > 0) { $event_title = "<br/>"; while ($ev = mysqli_fetch_array($chkEvent_res)) { $event_title = stripslashes($ev["event_title"])."<br/>"; } mysqli_free_result($chkEvent_res); } else { $event_title = ""; } echo"<td valign=\"top\"><a href=\"javascript:eventWindow ('event.php?m=".$month."&d=".$dayArray["mday"]."&y=$year');\">".$dayArray["mday"]."</a><br/>".$event_title."</td>\n"; unset($event_title); $start += ADAY; } } echo "</tr></table>"; mysqli_close($mysqli); ?> </body> </html>
-
Mod - in a very tired moment, I put up my database password...any chance I can get that deleted? Thank you!
-
I have a calendar that users can add events to, and I had it previously so that the hour had to be entered 1 - 24. I wanted it to be 1 - 12 and users can select AM or PM The code I've done for PM isn't working. Am I making this too complicated? Thanks! <html> <head> <title>Show/Add Events</title> </head> <body> <h1>Show/Add Events</h1> <?php $mysqli = mysqli_connect ("97.74.218.110","csteffen","Summer09","csteffen"); //add new event if ($_POST) { $m = $_POST["m"]; $d = $_POST["d"]; $y = $_POST["y"]; if ($_POST["event_time_ampm"] = am) { $event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].":".$_POST["event_time_mm"].":00"; } else if ($_POST["event_time_ampm"] = pm) { while ($hour = $_POST["event_time_hh"] + 12) { $event_date = $y."-".$m."-".$d." ".$hour.":".$_POST["event_time_mm"].":00"; }} $insEvent_sql = "INSERT INTO calendar_events (event_title, event_shortdesc, event_start) VALUES ('".$_POST["event_title"]."', '".$_POST["event_shortdesc"]."', '$event_date')"; $insEvent_res = mysqli_query($mysqli, $insEvent_sql) or die(mysqli_error($mysqli)); } else { $m = $_GET["m"]; $d = $_GET["d"]; $y = $_GET["y"]; } //show events $getEvent_sql = "SELECT event_title, event_shortdesc, date_format(event_start, '%I:%i %p') AS fmt_date FROM calendar_events WHERE month(event_start) = '".$m."' AND dayofmonth(event_start) = '".$d."' AND year(event_start) = '".$y."' ORDER BY event_start"; $getEvent_res = mysqli_query($mysqli, $getEvent_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($getEvent_res) > 0) { $event_txt = "<ul>"; while ($ev = mysqli_fetch_array($getEvent_res)) { $event_title = stripslashes($ev["event_title"]); $event_shortdesc = stripslashes($ev["event_shortdesc"]); $fmt_date = $ev["fmt_date"]; $event_txt .= "<li><strong>".$fmt_date."</strong>: ".$event_title."</br>".$event_shortdesc."</li>"; } $event_txt .= "</ul>"; mysqli_free_result($getEvent_res); } else { $event_txt = ""; } mysqli_close($mysqli); if ($event_txt != "") { echo "<p><strong>Today's Events:</strong></p> $event_txt <hr/>"; } if(isset($_COOKIE['ID_staples_clubs']) && isset($_COOKIE['Key_staples_clubs'])) { //show form echo " <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\"> <p><strong>Would you like to add an event?</strong><br/> Complete the form below and press the submit button to add an event</p> <p><strong>Event Title:</strong><br/> <input type=\"text\" name=\"event_title\" size=\"25\" maxlength=\"25\" /> <p><strong>Event Description:</strong><br/> <input type=\"text\" name=\"event_shortdesc\" size=\"25\" maxlength=\"255\" /> <p><strong>Event Time (hh:mm):</strong><br/> <input type=\"text\" name=\"event_time_hh\" size=\"2\" maxlength=\"2\" /> : <input type=\"text\" name=\"event_time_mm\" size=\"2\" maxlength=\"2\" /> <select name=\"event_time_ampm\"> <option value=\"am\">AM</option> <option value=\"pm\">PM</option> </select> <input type=\"hidden\" name=\"m\" value=\"".$m."\"> <input type=\"hidden\" name=\"d\" value=\"".$d."\"> <input type=\"hidden\" name=\"y\" value=\"".$y."\"> <br/><br/> <input type=\"submit\" name=\"submit\" value=\"Add Event\"> </form>"; } ?> </body> </html> [code]
-
I'm getting the error -- Parse error: syntax error, unexpected '{' in /home/content/c/s/t/csteffen242/html/staples/event.php on line 46 I checked it over and couldn't find anything wrong with an extra bracket, but I could easily be missing something simple <html> <head> <title>Show/Add Events</title> </head> <body> <h1>Show/Add Events</h1> <?php $mysqli = mysqli_connect --- //add new event if ($_POST) { $m = $_POST["m"]; $d = $_POST["d"]; $y = $_POST["y"]; $event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].": ".$_POST["event_time_mm"].":00"; $insEvent_sql = "INSERT INTO calendar_events (event_title, event_shortdesc, event_start) VALUES ('".$_POST["event_title"]."', '".$_POST["event_shortdesc"]."', '$event_date')"; $insEvent_res = mysqli_query($mysqli, $insEvent_sql) or die(mysqli_error($mysqli)); } else { $m = $_GET["m"]; $d = $_GET["d"]; $y = $_GET["y"]; } //show events $getEvent_sql = "SELECT event_title, event_shortdesc, date_format(event_start, '%1:%i %p') as fmt_date FROM calendar_events WHERE month(event_start) = '".$m."' AND dayofmonth(event_start) = '".$d."' AND year(event_start)= '".$y."' ORDER BY event_start"; $getEvent_res = mysqli_query($mysqli, $getEvent_sql) or die(mysqli_error($mysqli)); if (mysqli_num_rows($getEvent_res) > 0) { $event_txt = "<ul>"; while ($ev = @mysqli_fetch_array($getEvent_res)) { $event_title = stripslashes($ev["event_title"]); $fmt_date = $ev["fmt_date"]; $event_txt .= "<li><strong>".$fmt_date."</strong>: ".$event_title."</br>".$event_shortdesc."</li>"; } $event_txt .= "</ul>"; mysqli_free_result($getEvent_res); } else { $event_txt = ""; } mysqli_close($mysqli); if ($event_txt != "" { echo "<p><strong>Today's Events:</strong></p> $event_txt <hr/>"; } //show form echo " <form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\"> <p><strong>Would you like to add an event?</strong><br/> Complete the form below and press the submit button to add an event</p> <p><strong>Event Title:</strong><br/> <input type=\"text\" name=\"event_title\" size=\"25\" maxlength=\"25\" /> <p><strong>Event Title:</strong><br/> <input type=\"text\" name=\"event_shortdesc\" size=\"25\" maxlength=\"255\" /> <p><strong>Event Time (hh:mm):</strong><br/> <select name=\"event_time_hh\">"; for ($x=1; $x <= 24; $x++) {echo "<option value=\"$x\">$x</option>"; } echo "</select> : <select name=\"event_time_mm\"> <option value=\"00\">00</option> <option value=\"00\">15</option> <option value=\"00\">30</option> <option value=\"00\">45</option> </select> <input type=\"hidden\" name=\"m\" value=\"".$m."\"> <input type=\"hidden\" name=\"d\" value=\"".$d."\"> <input type=\"hidden\" name=\"y\" value=\"".$y."\"> <br/><br/> <input type=\"submit\" name=\"submit\" value=\"Add Event\"> </form>"; ?> </body> </html>
-
I guess using PHP in MySQL would be a slight problem... haha shows how little I know Thank you! It worked!
-
Thank you! The only problem is my advisors field is first and last names, they're not seperated :/ Is there a way to change all of the spaces into underscores? I think I'll just do full name user names ex: advisor: Dan Smith --> username: dan_smith I have no idea if this is the correct, but this is what I have so far... INSERT INTO members2 (username, club) SELECT strtolower(str_replace(" ","_", advisor)), id FROM clubs
-
I have a database of clubs, and each of them has an advisor As an easy way to add users to the members database, I was thinking I could use mysql to find the first letter of each advisor name, and then the last name (everything after the space) and combine them to create the username to be saved on the members database. Also, I would like the club ID from the club database to be saved to the "club" field of the members database. Any suggestions?? Thank you!
-
No, the admins don't have a club...it's just the username and password and perm value of 1
-
Thank you! I tried that, but it's still not redirecting the admin for some reason... I set the perm field to be boolean, would that change anything?
-
In my members table, I have a field called "perm" and it's set to zero for all members. However, I have two administrators, and theirs are set to 1. I want my members page that shows up on login to redirect admins if their "perm" number is set to 1 Right now it's not having any errors, but it's not redirecting the admins. Thank you! Full code: <?php // Connects to your Database ... //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_staples_clubs'])) { $username = $_COOKIE['ID_staples_clubs']; $pass = $_COOKIE['Key_staples_clubs']; $check = mysql_query("SELECT * FROM members WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: login.php"); } //otherwise they are shown the member area else { $query = "SELECT clubs.*, members.* FROM clubs LEFT JOIN members ON members.club = clubs.id WHERE members.username = '{$_COOKIE['ID_staples_clubs']}'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { //admin if ($row['perm'] == 1) { header("Location: admin.php"); } //member else { echo "$row[name] <br />"; echo "Welcome, "; echo "$row[adv] <br />"; echo "<a href=edititem.php?id=$row[club]>Edit Club</a>"; echo "<br />"; echo "<a href=changepass.php>Change password</a><br />"; echo "<a href=logout.php>Logout</a>"; } } } } } else //if the cookie does not exist, they are taken to the login screen { header("Location: login.php"); } ?> Troublesome part: while ($row = mysql_fetch_array($result)) { //admin if ($row['perm'] == 1) { header("Location: admin.php"); } //member else { echo "$row[name] <br />"; echo "Welcome, "; echo "$row[adv] <br />"; echo "<a href=edititem.php?id=$row[club]>Edit Club</a>"; echo "<br />"; echo "<a href=changepass.php>Change password</a><br />"; echo "<a href=logout.php>Logout</a>"; }
-
Select all entries from database that include a phrase
csteff24 replied to csteff24's topic in PHP Coding Help
I think I kind of understand how I would loop it, but I have no idea how to get it to go through the loop for the days "monday", "tuesday", "wednesday", etc... -
I'm getting the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id = '160'' at line 1 This was working earlier... <?php include("include.php"); doDB(); if (!$_POST) { $get_club_sql = "SELECT * FROM clubs WHERE id = '".$_GET["id"]."'"; $get_club_res = mysqli_query($mysqli, $get_club_sql) or die(mysqli_error($mysqli)); while ($club_info = mysqli_fetch_array($get_club_res)) { $name = strtoupper($club_info['name']); $adv = $club_info['adv']; $meet = stripslashes($club_info['meet']); $descrip = stripslashes ($club_info['descrip']); $pres = $club_info['pres']; $email = $club_info['email']; } $display_block .= " <h1>".$name."</h1> <form action=\"\" method=\"post\"><p><strong>Faculty Advisor:</strong><br/> <input type=\"text\" name=\"adv\" size=\"30\" maxlength=\"50\" value=\"".$adv."\"></p> <p><strong>Meeting time/place:</strong><br/> <input type=\"text\" name=\"meet\" size=\"30\" maxlength=\"200\" value=\"".$meet."\"> <p><strong>Student President - (if multiple, use &):</strong><br/> <input type=\"text\" name=\"pres\" size=\"30\" maxlength=\"50\" value=\"".$pres."\"> <p><strong>President contact info:</strong><br/> <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"50\" value=\"".$email."\"> <p><strong>Club Description:</strong><br/> <textarea name=\"descrip\" cols=\"50\" rows=\"5\" wrap=\"virtual\">".$descrip."</textarea></p> <p><input type=\"submit\" name=\"submit\" value=\"Edit Club\"></p> </form>"; } else if ($_POST) { if ($_POST["adv"]) { $update_adv_sql = "UPDATE clubs SET adv = '".$_POST["adv"]."' WHERE id = '".$_GET["id"]."'"; $update_adv_res = mysqli_query($mysqli, $update_adv_sql) or die (mysqli_error($mysqli)); } if ($_POST["meet"]) { $update_meet_sql = "UPDATE clubs SET meet = '".$_POST["meet"]."' WHERE id = '".$_GET["id"]."'"; $update_meet_res = mysqli_query($mysqli, $update_meet_sql) or die (mysqli_error($mysqli)); } if ($_POST["pres"]) { $update_pres_sql = "UPDATE clubs SET pres = '".$_POST["pres"]."' WHERE id = '".$_GET["id"]."'"; $update_pres_res = mysqli_query($mysqli, $update_pres_sql) or die (mysqli_error($mysqli)); } if ($_POST["email"]) { $update_email_sql = "UPDATE clubs SET email = '".$_POST["email"]."' id = '".$_GET["id"]."'"; $update_email_res = mysqli_query($mysqli, $update_email_sql) or die (mysqli_error($mysqli)); } if ($_POST["descrip"]) { $update_descrip_sql = "UPDATE clubs SET descrip = '".$_POST["descrip"]."' id = '".$_GET["id"]."'"; $update_descrip_res = mysqli_query($mysqli, $update_descrip_sql) or die (mysqli_error($mysqli)); } mysqli_close($mysqli); $display_block = "<p>Your entry has been edited.</p>"; } ?> <html> <head> <title>Edit Club</title> </head> <body> <?php echo $display_block; ?> </body> </html> Thanks!
-
Am I using left join properly?
-
Select all entries from database that include a phrase
csteff24 replied to csteff24's topic in PHP Coding Help
I've never used a loop before... haha how would i do that? <?php $mysqli = mysqli_connect ("97.74.218.110","csteffen","Summer09","csteffen"); $display_block = "<h1>Monday</h1>"; $get_mon_sql = "SELECT id, name FROM clubs WHERE meet LIKE '%monday%' ORDER BY name"; $get_mon_res = mysqli_query($mysqli,$get_mon_sql) or die(mysqli_error($mysqli)); while ($mon = mysqli_fetch_array($get_mon_res)) { $id = $mon['id']; $name = ucwords(strtolower(stripslashes($mon['name']))); $display_block .= "<div style=\"text-align: center;\"><a href=\"showitem.php? id=".$id."\">".$name."</a> </div>"; } mysqli_free_result($get_mon_res); mysqli_close($mysqli); ?> <html> <head> <link href="css.css" rel="stylesheet" type="text/css"> <title>Clubs</title> </head> <body> <?php echo $display_block; ?> </body> </html> -
Select all entries from database that include a phrase
csteff24 replied to csteff24's topic in PHP Coding Help
Does my question make sense? -
$query = "SELECT * FROM clubs LEFT JOIN members ON members.club = clubs.id WHERE members.id = '$_COOKIE[iD_staples_clubs]'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "$row[name]"; } There's no errors, but the club name isn't showing up...Is that the proper way to echo the club name?
-
Oops I wasn't even paying attention! I feel like a complete idiot but I can't find the modify post button anywhere...