Jump to content

dmccabe

Members
  • Posts

    408
  • Joined

  • Last visited

    Never

Everything posted by dmccabe

  1. Ok I have this text: User Name (Real Name) I want to grab the text "User Name" and "Real Name" separately? How can I split them, I know it has something to do with Strpos and Substr, but I just cant get it right or anywhere close, this is where I get before getting all kinds of confused: $pos = strpos($author, "("); $name= substr($author, $pos, -1);
  2. Sorry if this has been asked a thousand times before, but can anyone recommend any good sites for free business orientated web templates? I have a site already using myBB, but I want to change the front page layouts and subsequent pages, but my design skills are nill. I did try search the site first but unfortunately "templates" is a very common word on these forums
  3. Oops! This link appears to be broken.Suggestions: •Reload this page later •View cached copy of page from Google •Search on Google:
  4. Can anyone tell me why regardless of which way I order the info retreived the database the "Scanner" always comes out on top? <?php $sql = "SELECT ASSET_TYPE_ID, ASSET_TYPE_NAME FROM tblassettype ORDER BY ASSET_TYPE_NAME ASC"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { $id=$row["ASSET_TYPE_ID"]; $name=$row["ASSET_TYPE_NAME"]; echo "<option VALUE=\"$id\">".$name."</OPTION>"; } ?> Contents of table: 1 Monitor 2 Laptop 3 PC 4 Printer 5 Switch 6 Router 7 Scanner 8 Server 9 KVM 10 Tape Drive Yet regardless of if the table is sorted ASC or DESC, the item 7 Scanner is either very top or very bottom of list?
  5. I havent done any php in a long time and I was never an expert at it when I did. I remember having particular problems with dates, calculations and storing dates in uk formats. So I am basically making an asset database and want to record things like date of purchase. Warranty expiration date etc. I will then want to create a report screen later that will allow us to view all items where the warranty expiration is due in the next X amount of months for example. The dates will be input on a form basis and in uk date format: DD/MM/YYYY So what type of field should I be using in the database to make this process easier?
  6. See this is what happens when you dont get to do any programming for a while. THanks MadTechie
  7. I have done quite a bit of PHP in the past and mostly with forms and stuff. I have always used action="<?php echo $_SERVER['PHP_SELF']; ?>" with no issues. However I am just starting a new form for someone and when submit is clicked then I am getting a 404 error and the URL is displayed as: Any ideas why?
  8. I am not a JS expert, but is it just me or does this look like it will only ever use the first 2 images? document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">') document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">') document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:1px;top:0px;">') document.write(slideimages[0]) <----- IMAGE 1 document.writeln('</div>') document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px">') document.write(slideimages[1]) <----- IMAGE 2 document.writeln('</div>') document.writeln('</div>') document.writeln('</div>') If I alter the values [1] and [0] to other numbers in the array it displays a different 2 images.
  9. Please help I have been racking my brains over this for hours. <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2 class="posttitle"><?php the_title(); ?></h2> <?php if ($post->ID == 18) { echo "<p style='text-align: center;'><img src='images/index_site_header.jpg' title='K Rouse Civil Engineers Head Office' title='K Rouse Civil Engineers Head Office' border='0' /></p>"; } ?> <?php // Beginning of Image Loop if ($post->ID == 206) { ?> <script language="JavaScript1.2"> ///////configure the below four variables to change the style of the slider/////// //set the scrollerwidth and scrollerheight to the width/height of the LARGEST image in your slideshow! var scrollerwidth='500px' var scrollerheight='325px' var scrollerbgcolor='#FFFFFF' //3000 miliseconds=3 seconds var pausebetweenimages=3000 //configure the below variable to change the images used in the slideshow. If you wish the images to be clickable, simply wrap the images with the appropriate <a> tag var slideimages=new Array() slideimages[0]='<img src="./wp-content/uploads/images/contracts/cheetham/9.JPG">' slideimages[1]='<img src="./wp-content/uploads/images/contracts/cheetham/10.JPG">' slideimages[2]='<img src="./wp-content/uploads/images/contracts/cheetham/65.JPG">' slideimages[3]='<img src="./wp-content/uploads/images/contracts/cheetham/64.JPG">' slideimages[4]='<img src="./wp-content/uploads/images/contracts/cheetham/63.JPG">' slideimages[5]='<img src="./wp-content/uploads/images/contracts/cheetham/4.JPG">' slideimages[6]='<img src="./wp-content/uploads/images/contracts/cheetham/2.JPG">' //extend this list ///////Do not edit pass this line/////////////////////// var ie=document.all var dom=document.getElementById if (slideimages.length>1) i=2 else i=0 function move1(whichlayer){ tlayer=eval(whichlayer) if (tlayer.left>0&&tlayer.left<=5){ tlayer.left=0 setTimeout("move1(tlayer)",pausebetweenimages) setTimeout("move2(document.main.document.second)",pausebetweenimages) return } if (tlayer.left>=tlayer.document.width*-1){ tlayer.left-=5 setTimeout("move1(tlayer)",50) } else{ tlayer.left=parseInt(scrollerwidth)+5 tlayer.document.write(slideimages[i]) tlayer.document.close() if (i==slideimages.length-1) i=0 else i++ } } function move2(whichlayer){ tlayer2=eval(whichlayer) if (tlayer2.left>0&&tlayer2.left<=5){ tlayer2.left=0 setTimeout("move2(tlayer2)",pausebetweenimages) setTimeout("move1(document.main.document.first)",pausebetweenimages) return } if (tlayer2.left>=tlayer2.document.width*-1){ tlayer2.left-=5 setTimeout("move2(tlayer2)",50) } else{ tlayer2.left=parseInt(scrollerwidth)+5 tlayer2.document.write(slideimages[i]) tlayer2.document.close() if (i==slideimages.length-1) i=0 else i++ } } function move3(whichdiv){ tdiv=eval(whichdiv) if (parseInt(tdiv.style.left)>0&&parseInt(tdiv.style.left)<=5){ tdiv.style.left=0+"px" setTimeout("move3(tdiv)",pausebetweenimages) setTimeout("move4(scrollerdiv2)",pausebetweenimages) return } if (parseInt(tdiv.style.left)>=tdiv.offsetWidth*-1){ tdiv.style.left=parseInt(tdiv.style.left)-5+"px" setTimeout("move3(tdiv)",50) } else{ tdiv.style.left=scrollerwidth tdiv.innerHTML=slideimages[i] if (i==slideimages.length-1) i=0 else i++ } } function move4(whichdiv){ tdiv2=eval(whichdiv) if (parseInt(tdiv2.style.left)>0&&parseInt(tdiv2.style.left)<=5){ tdiv2.style.left=0+"px" setTimeout("move4(tdiv2)",pausebetweenimages) setTimeout("move3(scrollerdiv1)",pausebetweenimages) return } if (parseInt(tdiv2.style.left)>=tdiv2.offsetWidth*-1){ tdiv2.style.left=parseInt(tdiv2.style.left)-5+"px" setTimeout("move4(scrollerdiv2)",50) } else{ tdiv2.style.left=scrollerwidth tdiv2.innerHTML=slideimages[i] if (i==slideimages.length-1) i=0 else i++ } } function startscroll(){ if (ie||dom){ scrollerdiv1=ie? first2 : document.getElementById("first2") scrollerdiv2=ie? second2 : document.getElementById("second2") move3(scrollerdiv1) scrollerdiv2.style.left=scrollerwidth } else if (document.layers){ document.main.visibility='show' move1(document.main.document.first) document.main.document.second.left=parseInt(scrollerwidth)+5 document.main.document.second.visibility='show' } } window.onload=startscroll </script> <ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight}; bgColor=&{scrollerbgcolor}; visibility=hide> <layer id="first" left=1 top=0 width=&{scrollerwidth}; > <script language="JavaScript1.2"> if (document.layers) document.write(slideimages[0]) </script> </layer> <layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide> <script language="JavaScript1.2"> if (document.layers) document.write(slideimages[1]) </script> </layer> </ilayer> <script language="JavaScript1.2"> if (ie||dom){ document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">') document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">') document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:1px;top:0px;">') document.write(slideimages[0]) document.writeln('</div>') document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px">') document.write(slideimages[1]) document.writeln('</div>') document.writeln('</div>') document.writeln('</div>') } </script> <p align=\"center\"><font face=\"Arial\" size=\"-2\">Cheetham Hill Manchester<br> <a href=\"http://www.krouse.co.uk\">K Rouse</a></font></p> <?php } // End of Image Loop ?> <?php the_content(__('Read the rest of this page »')); ?> <?php wp_link_pages(); ?> <?php edit_post_link(__('Edit'), '<p>', '</p>'); ?> </div> <?php endwhile; endif; ?> <?php get_sidebar(); ?> <?php get_footer(); ?> It is the page template file from a wordpress theme that I have added some java into from a script here: http://www.dynamicdrive.com/dynamicindex14/leftrightslide2.htm Now I have tried every way possible and I just cannot get it work right. IT is meant to loop through the images you specify in the array. It loops through the first 2 no problems but then when the subsequent images are meant to come up it just says "Undefined". IT is driving me crackers. If I take the code and put it in a html file then no problems whatsoever
  10. Try $fetch_email = mysql_query($query_private); $row = mysql_fetch_row($fetch_email); and if(!empty($row[0])) { $this->body .= "<input type=text name=b[email] value=\"".$row[0]."\" class=details>";
  11. Basically what you are needing to do is to record the date when posting your blog to your database. The for your archive simply create the sql queries to order them by date and output the results. YOu can split them in to day year month etc by performing calculations on the date they were entered and the date now. http://uk3.php.net/date
  12. Now I am not on about tag clouds here so. Like in the premade forum scripts you have tags in the templates for {user.name} and this grab the username of the person, so the person doing the template doesnt need php code to grab the data from database or session. How can I acheive something similar myself? I dont know what you would call this process so I have called a tag library, please correct me if I am wrong.
  13. i have asked this before I think, but it was a long time ago. i am creating a database for work and I need to create an audit trail of who did what. Is there anyway to set up triggers on a mySQL database so that when a field is update it captures certain information in to another table in the database?
  14. ah I missed the bit about the Location you were right thanks. However I now have a new problem I get this: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/techmonk/public_html/projects/freelance/register.php on line 37 After making a change to check they weren't already validated: <?php SESSION_START(); include('dbconnect.php'); if (isset($_GET['vcode']) && !empty($_GET['vcode'])) { $vcode = $_GET['vcode']; $uid = $_GET['user']; $query = "SELECT `isactive`,`validation_code` FROM `users` WHERE `ID` = '$uid'"; $result = mysql_query($query); if ($result) { $row = mysql_fetch_row($result); $vcode_var = $row['validation_code']; $isactive = $row['isactive']; if ($isactive < 1) { if ($vcode == $vcode_var) { $query = "UPDATE `users` SET `isactive` = '1' WHERE `ID` = '$uid'"; if (!mysql_query($query)) { die(mysql_error()); } else { $_SESSION['uid'] = $uid; header( 'Location: profile.php' ) ; } ` } else { echo "Authentication failure, there may be a problem with the website, please click here to contact an admin."; } } else { echo "The user requested is already active, please click here to login or here to have your username and password sent to you."; } } else { die(mysql_error()); } } $usererror = 0; $passerror = 0; $emailerror = 0; if (isset($_POST['submit'])) { <---- this is line 37 if (empty($_POST['username'])) { echo "<font color='#FF0000'>You must specify a username!<br /></font>"; $usererror = 1; } elseif (empty($_POST['password'])) { echo "<font color='#FF0000'>You must specify a password!<br /></font>"; $passerror = 1; } elseif ($_POST['password'] != $_POST['confirm_password']) { echo "<font color='#FF0000'>Your password and confirmation do not match!<br /></font>"; $passerror = 1; } elseif (!preg_match("/^[^@]*@[^@]*\.[^@]*$/", $_POST['email'])) { echo "<font color='#FF0000'>Invalid E-mail address, please try again!</font><br />"; $emailerror = 1; } I have indicated line 37, but I have not modified that line nor any of the other lines since posting in this thread so dont see why the error is there?
  15. Thanks, I got rid of the error by removing whitepsace at the end of the dbconnet script, but not it just doesnt redirect?
  16. Cant you just include include a small header file on one of the site, the use php include on the rest of the sites?
  17. The error is this: Warning: Cannot modify header information - headers already sent by (output started at /home/techmonk/public_html/projects/freelance/dbconnect.php:17) in /home/techmonk/public_html/projects/freelance/register.php on line 16 THis is dbconnect.php <? /*--------- DATABASE CONNECTION INFO---------*/ $hostname="localhost"; $mysql_login=""; $mysql_password=""; $database=""; // connect to the database server if (!($db = mysql_pconnect($hostname, $mysql_login , $mysql_password))){ die("Can't connect to database server."); }else{ // select a database if (!(mysql_select_db("$database",$db))){ die("Can't connect to database."); } } ?> and this is the register.php again: <?php SESSION_START(); include('dbconnect.php'); if (isset($_GET['vcode']) && !empty($_GET['vcode'])) { $vcode = $_GET['vcode']; $uid = $_GET['user']; $query = "SELECT `validation_code` FROM `users` WHERE `ID` = '$uid'"; $result = mysql_query($query); if ($result) { $row = mysql_fetch_row($result); $vcode_var = $row[0]; if ($vcode == $vcode_var) { $_SESSION['uid'] = $uid; header( 'profile.php' ) ; } else { echo "Failure!"; } } else { die(mysql_error()); } } There is stuff after this, but nothing before it and no white spaces
  18. I am working on a registration script and all is working well, however when the user clicks the link in the email to validate their account, I want it to redirect them to the profile.php page, however I get the modified headers already sent message and realise this becasue the header has to be at the top, so how to get round this? <?php SESSION_START(); include('dbconnect.php'); if (isset($_GET['vcode']) && !empty($_GET['vcode'])) { $vcode = $_GET['vcode']; $uid = $_GET['user']; $query = "SELECT `validation_code` FROM `users` WHERE `ID` = '$uid'"; $result = mysql_query($query); if ($result) { $row = mysql_fetch_row($result); $vcode_var = $row[0]; if ($vcode == $vcode_var) { $_SESSION['uid'] = $uid; header( 'profile.php' ) ; } else { echo "Failure!"; } } else { die(mysql_error()); } }
  19. lol as always, after asking I sorted it $status_query = "SELECT ID,NAME FROM `tbl_status`"; $location_query = "SELECT ID,NAME FROM `tbl_locations`"; $status_result = mysql_query($status_query); $location_result = mysql_query($location_query); echo "<table><tr><th> </th>"; while ($row = mysql_fetch_array($location_result)) { echo "<th>{$row['NAME']}</th>"; } echo "<th>Totals</th></tr>"; while ($status= mysql_fetch_array($status_result)) { echo "<tr><td>{$status['NAME']} </td>"; $total = 0; $location_result = mysql_query($location_query); while ($location = mysql_fetch_array($location_result)) { $query = "SELECT * from `tbl_vehicles` WHERE `STATUS_ID` = '{$status['ID']}' AND `LOCATION_ID` = '{$location['ID']}'"; $result = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result); $total = $total + $count; echo "<td><a href='http://intranet/dev/temp/remarketing/reporting.php?LOCATION_ID={$location['ID']}&STATUS_ID={$status['ID']}&submit=Search'>$count</a></td>"; } echo "<td>$total</td></tr>"; } echo "</table>";
  20. Ok I will explain this the best I can and I hope someone understands and can help. I have 3 tables I want to create a table like this: I want the data in the table to be generated on the fly by reading the names of the locations and status' for the header row and the left column, then I want to automatically fill the values in as well, by reading for the vehicle table the number of vehicles at location1 with a status of status1. I cant show you the code I have so far, or rather I can but it just isnt even close to getting it right. I know the code for the selecting the data from the tables, but I am stuck on how to put the results in the right places.
  21. Does anyone one know if this is possible?
  22. Thanks for the help, but I dont fully understand what you mean? I have to specify the fields each time? I want it to remember the query as it was run last, so then it can pass that query to the excel export script. Excel Export Script: <?php header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=branchlist.xls"); header("Pragma: no-cache"); header("Expires: 0"); include($_SERVER['DOCUMENT_ROOT'] . 'connect2.php'); //mysql_connect(localhost,$username,$password); //@mysql_select_db($database) or die("Unable to select database"); $select = "SELECT `name`, `code`, `address`, `post_code`, `front_line`, `back_line`, `fax`, `mobile` FROM tbl_branches WHERE `live` = '1' ORDER BY `name` ASC"; $export = mysql_query($select); $count = mysql_num_fields($export); for ($i = 0; $i < $count; $i++) { $header .= mysql_field_name($export, $i)."\t"; } while($row = mysql_fetch_row($export)) { $line = ''; foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = "\t"; } else { $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } $data = str_replace("\r", "", $data); if ($data == "") { $data = "\n(0) Records Found!\n"; } print "$header\n$data"; ?> so what I would like to do is pass the query in where it currently has: $select = "SELECT `name`, `code`, `address`, `post_code`, `front_line`, `back_line`, `fax`, `mobile` FROM tbl_branches WHERE `live` = '1' ORDER BY `name` ASC"; so instead it says something like: $select = $_SESSION['LAST_QUERY'];
×
×
  • 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.