Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
This is the second time in 24 hours I've said this: Textarea's don't have value=""! The content goes between the two textarea tags!
-
It does, but that array only exists while you're looping through it, then the next row overwrites it. I was just trying to get it all out into a seperate array that you could manage.
-
Here, try something like this: <? //Make a big array for all our bookings $bookings = array(); $query_booked = "SELECT * FROM booking WHERE week_id = '$weekID' AND period = '$period' AND day = '$day' ORDER BY id ASC"); $booked = mysql_query($query_booked, $connect) or die(mysql_error()); while($row_booked = mysql_fetch_assoc($booked)){ //Get the bookings for this room $roomID = $row_booked['roomID']; $roomBookings = $bookings[$roomID]; $roomBookings[] = //fill in the date info, etc. $bookings[$roomID] = $roomBookings; //Put it back in the big array. } print_r($bookings); ?> Then, you'll have an array for each room based on ID, of all their bookings, so when you loop through the rooms to show them, you can just use that array which is in $bookings. I added a print_r at the end so you could see what it looks like. Edit: Using a mysql JOIN here is probably best, but I don't know how to do them properly, so I can't help you there. This is how I'd do it.
-
How do I make these three divs always be the same height, no matter what the content in them is? I know how to give them a minimum that works in Fx & IE, but now that it's past the minimum, it looks wrong: Here's what I mean: http://www.grady.us/temp.gif
-
Okay, I'm trying to figure this out, sorry if I'm being slow. You have a table of rooms, and another of room bookings. You need to get all the bookings for a certain week, and a list of all the rooms. Then you need to tell which rooms are booked, so you can mark them as such when you print the records. Do I have this right?
-
Why don't you make a field in your rooms and mark it either booked or available? Wouldn't that be easier then looping through the bookings?
-
Then this belongs on the javascript forum! Check out mootools, it has a great library of js effects.
-
"Note: When safe mode is enabled, PHP checks whether the directory in which you are about to operate has the same UID (owner) as the script that is being executed." I wonder if that could be it?
-
Also, if you're trying to find out how many, not just get unique, you can use count()
-
"If you choose Win from dropdown, then on web (upper one is web witch is seperated with blackline and below is results adding panel witch one is protected with password) score number will changes." Are you saying you want it to change right then, before you hit any buttons? That's done with javascript.
-
Use the MYSQL DISTINCT keyword. http://dev.mysql.com/doc/refman/5.0/en/select.html
-
Oh if you use thorpe's way, he used classes. He misspelled switch, so fix that, and use his.
-
This is the problem with letting a program like Dreamweaver write your code for you. Now you don't really know what's going on... Put all of the checking inside a while($row_booked = mysql_fetch_assoc($booked)){
-
http://www.phpfreaks.com/forums/index.php/topic,96280.0.html
-
Make it a class, such as winner. do <span class="winner">Winner</span> and in your CSS file, specify the color.
-
I don't see an fopen in that code at all?
-
So what's the problem?
-
Where is $row_booked['room_id'] coming from?
-
We don't need to see the HTML, just the PHP code and use the code tags!
-
We can't see the order of the code. Is that if inside your do/while? Post the code as is.
-
On the mysql_query() you need to have that OR die(mysql_error()); part - that error indicates something failed in your query. (sorry to bump an old post, but I went to bed last night without finishing up here ) Personally, I think the do while syntax is much less readable then the simple while() - you're putting your crucial part way at the end.
-
I see plenty of non-default thumbnails there. When you do print_r($row), that shows you what was returned from the db. The code you posted when you asked about where to put distinct does not show the query, just some HTML output. Instead of trying to print an image try just printing $row['thumbURL'] and seeing what it's set to.
-
while does not have an else. Try this: (I also fixed a few other things for you) <?php if(isset($_SESSION['user_name'])){ ?> <blockquote><p align="center"><img src="img/TopBanner02.jpg" width="1024" height="100" /><p></p> <table width="200" border="0" align="center"> <tr> <td><a href="newrec.php"><img src="img/addnewbtn.jpg" width="146" height="38" border="0" /></td> <td><a href="delrec.php"><img src="img/deletebtn.jpg" width="146" height="39" border="0" /></td> <td><a href="updaterec.php"><img src="img/updatebtn.jpg" width="146" height="39" border="0" /></td> <td><a href="searchrec.php"><img src="img/searchbtn.jpg" width="146" height="39" border="0" /></td> </tr> </table> <p align="center" class="style1"><u>Records Detail</u> <p></p></blockquote> <?php define ('DB_USER', ''); define ('DB_PASSWORD', ''); define ('DB_HOST', 'localhost'); define ('DB_NAME', 'regent'); $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error()); mysql_select_db (DB_NAME) OR die ('Could not select database: ' .mysql_error() ); $result = mysql_query("SELECT * FROM guest WHERE guest_room=$guest_room") OR die ('MYSQL Error:: ' .mysql_error() ); if(mysql_num_rows($result)){ while($row = mysql_fetch_array($result)){ //getting each variable from the table $record_id = $row['record_id']; $date = $row['day'].'-'.$row['month'].'-'.$row['year']; //$self = $_SERVER['PHP_SELF']; echo "<table width='61.5%' height='496' border='1' align='center' cellpadding='0' cellspacing='0' bordercolor='#808080' bgcolor='#FFFFCC' id='AutoNumber1' style='border-collapse: collapse'> <tr> <td width='17%' height='33'><div align='center'><font size='2'><b>Guest room #:</b></font> </div></td> <td width='83%' height='33' align='left'> <input name='guest_room' type='text' disabled size='4' value=" . $row['guest_room'] ." maxlength='4' tab='1' /> </tr>"; echo " <tr> <td width='17%' height='34'><div align='center'><b><font size='2'>Date: </font> </b></div></td> <td width='83%' height='34'> <div align='left'> <input name='date' type='text' disabled id='date' size='10' value=" . $row['date'] ." > </tr>"; echo " <tr> <td width='17%' height='36'><div align='center'><b><font size='2'>Time: </font> </b></div></td> <td width='83%' height='36'><div align='left'> <input name='time' type='text' disabled id='time' value=" . $row['time'] , $row['ampm'] ." size='10'> </div></td> </tr>"; echo " <tr> <td width='17%' height='141'><div align='center'><b><font size='2'>Issue: </font></b></div></td> <td width='83%' height='141'> <textarea name='issue' cols='55' rows='8' disabled tab='8'>". $row['issue'] ."</textarea> </td> </tr>"; echo " <tr> <td width='17%' height='142'><div align='center'><b><font size='2'>Remark: </font></b></div></td> <td width='83%' height='142'> <textarea name='remark' cols='55' rows='8' disabled tab='9'>". $row['remark'] ."</textarea> </td> </tr> "; echo " <tr> <td width='17%' height='38'><div align='center'><b><font size='2'>Follow up:</font></b></div></td> <td width='83%' height='38'> <input name='follow_up' type='text' disabled id='follow_up' value=". $row['follow_up'] ." size='4'></td> </tr>"; echo" <tr> <td height='35'><div align='center'><b><font size='2'>Assigned to:</font></b></div></td> <td height='35' colspan='2'> <input name='assigned_to' type='text' disabled id='assigned_to' value=". $row['assigned_to'] ." size='15' tab='11' /></td> </tr>"; echo" <tr> <td height='35'><div align='center'><b><font size='2'>Date Resolved:</font></b></div></td> <td height='35' colspan='2'> <input name='date_resolved' type='text' disabled id='date_resolved' size='10' value=". $row['date_resolved'] ." > </td> </tr>"; echo "<p></p><p></p>"; echo "</table>"; } }else{ echo '<blockquote><p align="center">no record found!</p></blockquote>'; } }else{ echo '<blockquote><p align="center">Your login session is expired.</br>Please <a href="gsl.htm">LOGIN</a> again</p></blockquote>'; } ?>
-
You didn't post your new query. It should be something like SELECT DISTINCT(*) FROM ...
-
Not as far as I know, as you don't have control over the page. What you're trying to do is likely against the TOS of MySpace anyway, so I've helped as much as I am willing to with this. Have fun.