Jump to content

twilitegxa

Members
  • Posts

    1,020
  • Joined

  • Last visited

About twilitegxa

  • Birthday 04/18/1982

Profile Information

  • Gender
    Female
  • Location
    Knoxville, Tennessee

twilitegxa's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Which queries does yours replace? Sorry I feel like a complete idiot now :-(
  2. Okay so I added some more code, but I'm lost. :-( Help? $character_defect = "SELECT c.id, c.identity, c.desc, d.defect, d.id as defect_id FROM character_defects AS c LEFT JOIN defects AS d USING(id) WHERE c.identity = 'Sailor Moon'"; $character_defect_res = mysql_query($character_defect, $conn) or die(mysql_error()); while ($characters_defect_info = mysql_fetch_array($character_defect_res)) { $display_block .= " <tr> <td>$character_defect</td> </tr>"; } } ?> I know displaying the $character_defect variable is wrong, but how do I create the variables I want? I want to display the defect field from the defects table where the id from character_defects table matches the defect from the defects table. I hope that made sense.
  3. It is just displaying the code that many times now: http://zertinternetmarketing.com/rpg/profile.php
  4. Okay now then another stupid question...how do I display the data? I tried this, but it didn't work :-( $character_defect = "SELECT c.id, c.identity, c.desc, d.defect, d.id as defect_id FROM character_defects AS c LEFT JOIN defects AS d USING(id) WHERE c.identity = 'Sailor Moon'"; $display_block .= " <tr> <td>$character_defect</td> </tr>"; }
  5. Or...can I just select the data from one table and some data from the othe table based on a column field from the first table? I can't remember how to do this!!! :-(
  6. Hey guys. I'm getting back into PHP after about a year or two of a little hiatus and I need some help getting back into it. I am currently working on some old coding before I upgrade (will be learning that shortly), but I need some help joining these two tables so I can output the data I want to. Here's the basic premisis: Table 1: (defects table) id (#'s) defect (text) Table 2: (character defects table) id (#'s) identity (links the defects with the character) defect (matches the id from the previous table) desc (additional info about the defect for that particular character) Here's the code I have so far: //gather the defects $get_defects = "select * from defects"; $get_defects_res = mysql_query($get_defects, $conn) or die(mysql_error()); while ($defects_info = mysql_fetch_array($get_defects_res)) { $defects_id = $defects_info['id']; $defects = $defects_info['defect']; } //gather the character defects $get_character_defects = "select * from character_defects where identity = 'Sailor Moon'"; $get_character_defects_res = mysql_query($get_character_defects, $conn) or die(mysql_error()); $display_block .= "<table width=40% cellpadding=3 cellspacing=1 border=0>"; while ($character_defects_info = mysql_fetch_array($get_character_defects_res)) { $character_defects = $character_defects_info['defect']; $defect_desc = $character_defects_info['desc']; $character_defect = } So I have gathered all the defects and their respective id's, then gathered all the character defects where the identity is equal to a character (later this will be based on the logged in person and their selected character). So now I am stuck. I want to list all the defects this particular character has, plus the respective descriptions if they exist, but I don't know how to write the next part that connects them together. I'm thinking I need to JOIN them, but I'm kind of at a loss. I know, I know, I know...I should be using updated PHP. I haven't learned it yet and I'm waiting for a book to come in the mail for me to start learning, and then I will update it. My current server is running the old versions for now since this is what I know how to use and have examples to work with :-( Can anyone help me on this please? :-) It's very simple so far. I have the link if anyone needs it, although I doubt it will be as useful as the actual code I've listed above and the tables.
  7. Someone said there is a way to do it with some php code, but I didn't understand what they said. It's php within a Joomla plugin called Jumi, so I can't really add the CKEditor I don't think. And when we enter the text for example, like this into the text area: New Event Details Blah blah blah some more text here We're just pressing enter to add the line breaks, but when it saves it into the database, those line breaks either aren't saving or they aren't showing when we output the data. Can you see my code above and see which one it is and which I need to fix to solve the problem? For the text area, someone said I can either save it with nl2br when I put it into the database or when I display it use that, but I am not sure how to use it when displaying it. I think I had done it while submitting the data, but the problem is, I need to have the text displayed in the text area field when they edit the event and I am not doing it properly because it's not showing up. :-(
  8. I have a site that is using some simple php to submit a form, but I would like to be able to have it automatically add the line breaks whenever I press enter when entering my text, as well as automatically turning any web address into a clickable link. Is this possible, and can anyone show me how please? Here is my code: <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_spectac = "localhost"; $database_spectac = "database"; $username_spectac = "username"; $password_spectac = "password"; $spectac = mysql_pconnect($hostname_spectac, $username_spectac, $password_spectac) or trigger_error(mysql_error(),E_USER_ERROR); ?> <?php if(isset($_POST['eventDate'])){ $date = date('Y-m-d',strtotime($_POST['eventDate'])); } if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE tblEventCustom SET eventDate=%s, eventFile=%s, eventActive=%s, eventCost=%s, eventName=%s, eventFriendlyName=%s, eventDesc=%s WHERE eventId=%s", GetSQLValueString($date, "date"), GetSQLValueString($_POST['eventFile'], "text"), GetSQLValueString($_POST['eventActive'], "int"), GetSQLValueString($_POST['eventCost'], "int"), GetSQLValueString($_POST['eventName'], "text"), GetSQLValueString($_POST['eventFriendlyName'], "text"), GetSQLValueString($_POST['eventDesc'], "text"), GetSQLValueString($_POST['eventId'], "int")); mysql_select_db($database_spectac, $spectac); $Result1 = mysql_query($updateSQL, $spectac) or die(mysql_error()); } $colname_getEventDetails = "-1"; if (isset($_POST['eventId'])) { $colname_getEventDetails = $_POST['eventId']; } mysql_select_db($database_spectac, $spectac); $query_getEventDetails = sprintf("SELECT * FROM tblEventCustom WHERE eventId = %s", GetSQLValueString($colname_getEventDetails, "int")); $getEventDetails = mysql_query($query_getEventDetails, $spectac) or die(mysql_error()); $row_getEventDetails = mysql_fetch_assoc($getEventDetails); $totalRows_getEventDetails = mysql_num_rows($getEventDetails); mysql_select_db($database_spectac, $spectac); $query_getFileList = "SELECT * FROM tbl_eventFiles"; $getFileList = mysql_query($query_getFileList, $spectac) or die(mysql_error()); $row_getFileList = mysql_fetch_assoc($getFileList); $totalRows_getFileList = mysql_num_rows($getFileList); ?> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> </script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { $( "#datepicker" ).datepicker(); $(eventDate).datepicker({dateFormat: 'yy-mm-dd'}) }); </script> <? if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { ?><div align="center" >Event Updated <br> <a href="http://spectaculareventcenter.com/2012/index.php/component/content/article/2-uncategorised/22-editevents">Go back to event list. </a></div><? } ?> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">ID:</td> <td><?php echo $row_getEventDetails['eventId']; ?></td> </tr> <tr valign="baseline"> <td nowrap align="right">Event Date:</td> <td><input type="text" name="eventDate" value="<?php echo htmlentities($row_getEventDetails['eventDate'], ENT_COMPAT, ''); ?>" size="32" id="datepicker"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Event Active:</td> <td><p> <label> <input <?php if (!(strcmp($row_getEventDetails['eventActive'],"1"))) {echo "checked=\"checked\"";} ?> type="radio" name="eventActive" value="1" id="RadioGroup1_0"> Yes</label> <br> <label> <input <?php if (!(strcmp($row_getEventDetails['eventActive'],"0"))) {echo "checked=\"checked\"";} ?> type="radio" name="eventActive" value="0" id="RadioGroup1_1"> No</label> <br> </p></td> </tr> <tr valign="baseline"> <td nowrap align="right">Event Cost:</td> <td><input type="text" name="eventCost" value="<?php echo htmlentities($row_getEventDetails['eventCost'], ENT_COMPAT, ''); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Event Name:</td> <td><input type="text" name="eventName" value="<?php echo htmlentities($row_getEventDetails['eventName'], ENT_COMPAT, ''); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Display Name:</td> <td><input type="text" name="eventFriendlyName" value="<?php echo htmlentities($row_getEventDetails['eventFriendlyName'], ENT_COMPAT, ''); ?>" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Event Desc:</td> <td><textarea cols=32 rows=5 name="eventDesc" value="<?php echo htmlentities($row_getEventDetails['eventDesc'], ENT_COMPAT, ''); ?>" size="32"></textarea></td> </tr> <tr valign="baseline"> <td nowrap align="right">Event File:</td> <td><select name="eventFile"> <?php do { ?> <option value="<?php echo $row_getFileList['fileName']?>"<?php if (!(strcmp($row_getFileList['fileName'], $row_getEventDetails['eventFile']))) {echo "selected=\"selected\"";} ?>><?php echo $row_getFileList['fileName']?></option> <?php } while ($row_getFileList = mysql_fetch_assoc($getFileList)); $rows = mysql_num_rows($getFileList); if($rows > 0) { mysql_data_seek($getFileList, 0); $row_getFileList = mysql_fetch_assoc($getFileList); } ?> </select> <a href="http://spectaculareventcenter.com/2012/customCode/file_upload.php" target="_blank">Upload File</a></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Update record"></td> </tr> </table> <p> <input type="hidden" name="MM_update" value="form1"> <input type="hidden" name="eventId" value="<?php echo $row_getEventDetails['eventId']; ?>"> </p> </form> <?php mysql_free_result($getEventDetails); mysql_free_result($getFileList); ?> Also, when the "event" is edited, all the other fields are auto-populate with the data from the database table, but the text area one is not auto-populated (i.e. it's blank instead). Can you tell me how to write this code properly so I have it working the way I need it? Any help is greatly appreciated!
  9. Oh! I just figured it out! The table was users, and not carers, so now it works! Thank you for your help! You pointed me in the right direction with your questions! Thank you so much!
  10. I'm having trouble getting my records deleted from my table. Here is part of the admin page (the delete code I'm trying to use starts around line 1050): <td style="border:0px; text-align:center"><a href="?p=deletemember&user=<?=$id?>"><img src="images/icon_delete.png" style="border:0px" /></a></td> </tr> <? } } ?> </table> <? } if($p=='deletemember'){ $sql = "DELETE FROM `carers` WHERE `id`='".$_GET['user']."'"; mysql_query($sql); echo "<p class='fyi'>The selected carer has been deleted.</p>"; } if($p=='editmember'){ if($_POST['update2']){ $type = join(",", $_POST['type']); $sql="UPDATE `carers` SET `photo`='".$_POST['photo']."', `type`='".$type."', `availability`='".$_POST['availability']."', `experience`='".$_POST['experience']."', `qualifications`='".$_POST['qualifications']."', `description`='".$_POST['description']."', `active`='".$_POST['active']."' WHERE `uid`='".$_GET['user']."'"; mysql_query($sql); $sql="UPDATE `users` SET `email`='".$_POST['email']."', `phone`='".$_POST['phone']."', `firstname`='".$_POST['firstname']."', `lastname`='".$_POST['lastname']."', `location`='".$_POST['location']."' WHERE `id`='".$_GET['user']."'"; mysql_query($sql); echo "<p class='fyi'>Your information has been updated</p>"; } if($_POST['update']){ $sql="UPDATE `users` SET `email`='".$_POST['email']."', `phone`='".$_POST['phone']."', `firstname`='".$_POST['firstname']."', `lastname`='".$_POST['lastname']."', `location`='".$_POST['location']."' WHERE `id`='".$_GET['user']."'"; mysql_query($sql); echo "<p class='fyi'>Your information has been updated</p>"; } Please, can anyone tell me what I'm doing wrong and how to fix it? What other information would you need to answer my question? I couldn't fit the entire admin page because it exceeded the limit on there, but please let me know if you need to see more to help me. I have left an example of how the edit code works to see if that helps.
  11. I am trying to set my gradient in FireFox, but I can't get it quite right! From the body area, it's supposed to go from red to white, then it's supposed to go from white to the blue where the little logos start, and end before the bottom nav area, although on Safari I couldn't get the nav bar outside of the blue, so if you look in Safari you can see what I'm trying to achieve. After the logos, it's supposed to go straight to white. Can anyone help me get my CSS right? Here is what I have: body { background: #ffffff; background: -moz-linear-gradient(top, white 16.45%, #546a93 10%, #de4d20 20%, white 80%, #566991 85%, white 85%); background: -webkit-gradient(linear, 0 218, 0 100%, from(white), color-stop(0%, #546a93), color-stop(4%, #de4d20), color-stop(30%, white), color-stop(70%, white), color-stop(90%, #566991), color-stop(90%, white), to(white)); } The site can be viewed at: http://lhdairconditioning.com.au/ Any help would be greatly appreciated!
  12. Someone told me how to do this with a Flowplayer playlist (some JavaScript and HTML). Thanks for the help anyway! I guess I was in the wrong section of the forum!
  13. I was wondering if I could use an image swap similar to how this one is set up, but just swap the flv instead of the images: <script> function switch1(div) { if (document.getElementById('one')) { var option=['one','two']; for(var i=0; i<option.length; i++) { obj=document.getElementById(option[i]); obj.style.display=(option[i]==div)? "block" : "none"; } } } // function switchImg(i){ document.images["wine"].src = i; } </script> <style> #image-switch ul { margin:0 0 0 20px; color:red; list-style-type:none; } #image-switch li { padding:10px; } #image-switch #two, #image-switch #three { display:none; } #radiobs { width:150px; position:relative; margin:0; } #radiobs input { margin:0; padding:0; position:absolute; margin-left:6em; width:15px; } </style> <!-- gallery --> <div class="gallery"> <div class="display"> <div class="fright"><img src="/wp-content/themes/yorkpeoplefirst/assets/gallery2.jpg" id="wine" /><> <!--<div class="image i2"><img src="/wp-content/themes/yorkpeoplefirst/assets/gallery1.jpg" /><>--> <> <div class="thumbs"> <a href="#" onclick="switchImg('/wp-content/themes/yorkpeoplefirst/assets/gallery2.jpg')" class="first current-menu-item"><span>Informing people, influencing people and educating.</span></a> <a href="#" onclick="switchImg('/wp-content/themes/yorkpeoplefirst/assets/gallery1.jpg')" class="second"><span>Supporting each other through problems.</span></a> <> <>
  14. I need to do something similar to an image swap in CSS, so I am assuming it can be done with this as well. I have two buttons and two flv files. I want one to be already on the page, which is what I already have. I want the buttons, displayed above the video, to display the corresponding video in the spot where the current video is when the page is loaded. Basically, when the user clicks the first button, video1 is loaded onto the spot on the page. If they click button 2, then video2 is displayed on the spot on the page. How can I do this? Would it be similar to how you can swap images with CSS? Or would there be another method?
×
×
  • 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.