PHP - Divs Displayed Around A Circle?
At the moment i can retrieve information from a DB and display it nicely in a vertical line of boxes (some boxes with extra information as needed).
I basically need a version of this with exactly the same information, but instead of a top-down list of divs (boxes), I need them to be displayed going around a circle (starting top centre, going clockwise). Does anyone know if this is possible? And how easy would it be? Any scripts? It's already taken me ages to get the list pulling the appropriate info and displaying in a straight line. Thanks for any help/direction. Added: The number of divs displayed will be variable depending on what's in the DB. So I can't count on their being a certain number. Therefore the 'circle' would need to re-size in some way?! Similar TutorialsHi Guys, Some help here would be most appreciated. What im basically trying to do is create an image like a postmark stamp where the text curves around the inside of the circle. This text is dynamically generated and will basically be a persons name. So I need a circle with the persons name curving inside the circle edge at the top. I have attached a image of a postmark just incase anyone isnt sure what i mean. If anyone could help it would be great. Regards, Jon I am trying to run a php code on my site but it kept on saying page cannot be found. Any idea why its saying that??? Hi, I am generating certificates in php i can display the name in arabic but it will not print on the certicate. It can show the English names though! is there a special code to be able to show that? code: <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <title>Certificate Generator</title> </head> <body> <center> <br><br><br> <h3>Certificate Generator</h3> <br><br><br><br> <form method="post" action=""> <div class="form-group col-sm-6"> <input type="text" name="name" class="form-control" id="name" placeholder="Enter Name Here..."> </div> <button type="submit" name="generate" class="btn btn-primary">Generate</button> </form> <br> <?php if (isset($_POST['generate'])) { $name = strtoupper($_POST['name']); $name_len = strlen($_POST['name']); if ($name == "" ) { echo " <div class='alert alert-danger col-sm-6' role='alert'> Ensure you fill all the fields! </div> "; }else{ echo " <div class='alert alert-success col-sm-6' role='alert'> Congratulations! $name on your excellent success. </div> "; //designed certificate picture $image = "certi.png"; $createimage = imagecreatefrompng($image); //this is going to be created once the generate button is clicked $output = "certificate.png"; //then we make use of the imagecolorallocate inbuilt php function which i used to set color to the text we are displaying on the image in RGB format $white = imagecolorallocate($createimage, 205, 245, 255); $black = imagecolorallocate($createimage, 0, 0, 0); //Then we make use of the angle since we will also make use of it when calling the imagettftext function below $rotation = 0; //we then set the x and y axis to fix the position of our text name $origin_x = 200; $origin_y=240; //we then set the x and y axis to fix the position of our text occupation $origin1_x = 120; $origin1_y=90; //we then set the differnet size range based on the lenght of the text which we have declared when we called values from the form if($name_len<=7){ $font_size = 25; $origin_x = 190; } elseif($name_len<=12){ $font_size = 30; } elseif($name_len<=15){ $font_size = 26; } elseif($name_len<=20){ $font_size = 18; } elseif($name_len<=22){ $font_size = 15; } elseif($name_len<=33){ $font_size=11; } else { $font_size =10; } $certificate_text = $name; //font directory for name $drFont = dirname(__FILE__)."/developer.ttf"; //function to display name on certificate picture $text1 = imagettftext($createimage, $font_size, $rotation, $origin_x, $origin_y, $black,$drFont, $certificate_text); imagepng($createimage,$output,3); ?> <!-- this displays the image below --> <img src="<?php echo $output; ?>"> <br> <br> <!-- this provides a download button --> <a href="<?php echo $output; ?>" class="btn btn-success">Download My Internship Certificate</a> <br><br> <?php } } ?> </center> <footer> <center><p>Built with ❤ by <a href="https://olawanlejoel.github.io/portfolio/">Olawanle Joel</a></p></center> </footer> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> </body> </html> Edited May 22, 2020 by ramiwahdan typo error Code: [Select] function my_fav_quote_show_optin_form() { if (!empty($_POST['my_fav_quote_email'])) { my_fav_quote_opt_in(); } $out2 = ''; $out = '<form action="" name="myform "method="post" id="requestQuote">'; $out .= '<table style="padding="0px" width="40px">'; $out .= '<tr><td>Name:*</td><td><input type="text" name="my_fav_quote_name" id="my_fav_quote_name"/></td></tr>'; $out .= ''; $out .= '<tr><td>Email:*</td><td><input type="text" name="my_fav_quote_email" id="my_fav_quote_email"/></td></tr>'; $out .= ''; $out .= '<tr><td>Phone:*</td><td><input type="text" name="my_fav_quote_phone" id="my_fav_quote_phone"/></td></tr>'; $out .= ''; $out .= '<tr><td>Event Date(optional):</td><td><input type="text" name="my_fav_quote_date" id="my_fav_quote_date"/></td></tr>'; $out .= ''; $out .= '<tr><td>Estimated Number of Guests(optional):</td><td><input type="text" name="my_fav_quote_guest" id="my_fav_quote_guest"/></td></tr>'; $out .= ''; $out .= '<tr><td>Desired Price Range Per Person (optional):</td><td><input type="text" name="my_fav_quote_rate" id="my_fav_quote_rate"/></td></tr>'; $out .= ''; $out .= '<tr><td style="vertical-align: middle;">Message:<br>(List your special requests, any food allergies , event description , special menu items that are not listed or any other information you think will helpful) </td><td><textarea placeholder="" name="my_fav_quote_message" id="my_fav_quote_message"></textarea></td></tr>'; $out .= ''; $out .= '<tr><td>Security code:*</td><td><img src='.get_bloginfo('wpurl').'/wp-content/plugins/quote-cart/captcha.php?width=60&height=30&characters=5" /></td></tr>'; $out .= ''; $out .= '<tr><td>Input Above Security Code He *</td><td><input type="text" name="security_code" id="security_code" size="5"></td></tr>'; $out .= ''; $out .='<tr><td colspan="2">'; if ( function_exists( 'my_fav_quote_display' ) ){ $out .= my_fav_quote_display(); } if ( function_exists( 'my_fav_quote_display3' ) ){ $out .= my_fav_quote_display3(); } $out .='</td></tr>'; $out .= '<tr><td colspan=2 align=center><input type="submit" value="Request Quote" onclick="return chk_validation()" style="background-color:#000;color:#FFF;padding:5px;margin-top:10px;border:none;cursor:pointer;"/> <input type="button" onclick="formReset()" value="Reset form" /> </td></tr>'; $out .='</table></form>'; echo $out; ?> <script language="javascript" type="text/javascript"> //<![CDATA[ function validate_email(field,alerttxt) { apos=field.indexOf("@"); // alert(apos); dotpos=field.lastIndexOf("."); //alert(dotpos); if (apos<1||dotpos-apos<2) { return false;} else {return true;} } function chk_validation() { if(document.getElementById("my_fav_quote_name") && document.getElementById("my_fav_quote_name").value == '') { alert("Please Enter Name"); document.getElementById("my_fav_quote_name").focus(); return false; } if(document.getElementById("my_fav_quote_email").value == '') { alert("Please Enter Email"); document.getElementById("my_fav_quote_email").focus(); return false; } else { //alert(validate_email(document.getElementById("my_fav_quote_email").value,"Not a valid e-mail address!"); if (validate_email(document.getElementById("my_fav_quote_email").value,"Please enter valid e-mail address!")==false) { alert("Please enter valid e-mail address!"); document.getElementById("my_fav_quote_email").focus(); return false; } } if(document.getElementById("security_code").value == '') { alert("Please Enter Security Code"); document.getElementById("security_code").focus(); return false; } if(document.getElementById("quotes").value == '') { alert("Please add atleast one request quote"); document.getElementById("quotes").focus(); return false; } //return true; } //]]> </script> <?php } i need a form reset the actual problem is the normal reset is only reseting the fields but i need the information displayed using functions should also be reseted I have following error when i try to enter my student info into the database. ! ) Warning: Header may not contain more than a single header, new line detected. in C:\wamp\www\Student registration\new student registration\newStudentRegistrationFormvalidation.php on line 43 newStudentRegistrationFormvalidation.php <?php $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initial=$_POST['name_with_initial']; $date_of_birth=$_POST['date_of_birth']; $religion=$_POST['religion']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $grade_ID=$_POST['grade_ID']; $stream_ID=isset($_POST['stream_ID']) ? $_POST['stream_ID'] :''; $class_ID=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $currentdate=getdate(time()); $year=$currentdate["year"]; //admission number validation $answer=''; $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); $query="SELECT admission_no FROM student_info WHERE student_info.admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $answer=$row['admission_no'];} if($answer==0) { //line 43 header("location:student registrationDatabase.php?admission_no=".$admission_no."&year=".$year."&admission_date=".$admission_date."&full_name=".$full_name."&name_with_initial=".$name_with_initial."&date_of_birth=".$date_of_birth."&religion=".$religion."&address=".$address."&telephone=".$telephone."&grade_on_admission=".$grade_on_admission."&grade_ID=".$grade_ID."&stream_ID=".$stream_ID."&class_ID=".$class_ID."&student_house=".$student_house."&password=".$password."&description_about_st=".$description_about_st."&payment=".$payment); exit(); }else{ ?> <body> <?php echo "Admission number".$admission_no."This student has been alredy entered to the system ."."<BR>"."<BR>"."<BR>"; echo "<a href='newStudentRegistrationForm.php'>GO to manage student details page</a> "; exit(); }?> studentregistrationDatabase.php <?PHP $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initials=$_POST['name_with_initial']; $dob=$_POST['date_of_birth']; $religion=$_POST['religion']; //$gender=$_GET['gender']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $present_grade=$_POST['grade_ID']; $stream=$_POST['stream_ID']; $present_class=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $current=getdate(time()); $year=$current["year"]; $today = date("Y-m-d"); $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); //insert to database $query="select count(*) from student_info where admission_no='$admission_no'"; $result=mysql_query($query); $row=mysql_fetch_array($result); if($row[0]==0) { $query="insert into student_info values(null,'$admission_no','$admission_date','$full_name','$name_with_initials','$dob','$religion','$address','$telephone','$grade_on_admission','$password','$student_house','$description_about_st')"; $result=mysql_query($query); if($stream!=null){ $query="select class_id from class where class.grade_id='$present_grade' and class.class_name='$present_class' and class.stream='$stream'"; }else{ $query="select class_id from class where class.grade_id='$present_grade' and class.class_name='$present_class'"; } $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $class_id=$row['class_id']; } $query="insert into student_class values('$admission_no','$class_id','$year')"; $result=mysql_query($query); if($payment=="2000") { $query="insert into payment_amount values(null,'2000','$today')"; $result=mysql_query($query); $query="SELECT amount_id FROM payment_amount order by amount_id DESC limit 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { $amount_id=$row['amount_id']; } $query="insert into payment values('$admission_no','$amount_id')"; $result=mysql_query($query); }else{ $query="insert into payment_amount values(null,'0','$today')"; $result=mysql_query($query); $query="SELECT amount_id FROM payment_amount order by amount_id DESC limit 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { $amount_id=$row['amount_id']; } $query="insert into payment values('$admission_no','$amount_id')"; $result=mysql_query($query); } header("location:../new student registration-parent details/studentRegistrationParentDetailsForm.php?admission_no=".$admission_no); exit(); } else{ ?> <?php echo "Admission number".$admission_no."This student has been already entered to the system"."<BR>"."<BR>"."<BR>"; echo "<a href='student registration.php'>GO to registration page</a>"; exit(); } ?> so I am a beginner and have this very beginner-level PHP doubt. I have some basic code which is supposed to fetch the contents of a table and then display them in a table. What it's actually showing is the PHP code itself, instead of the table contents, in the browser. I'm using WAMP When I searched the net reasons given were 1. using short tags, and 2. some configuration problem. I haven't used short tags, and my wamp installation was done a long time back. Moreover this problem is not occuring all the time, even when I run the same code. Many thanks if anyone can suggest anything helpful. Sorry if I posted in the wrong place (new here). I'm teaching myself how to use php and mysql... I created a form to insert data into a mysql database, all went well and when I returned to the form it was blank. I then asked a friend to test it out aswell and when he loaded the form page, the data that entered before him was displayed? (it was still filled out with my info). Even after he refreshed it was still there... Hows this possible? How would I clear the form after its been submitted if it doesnt do it automatically? Thanks Drew I want to output the data and also the buttons in my php codes. But i do not know why the buttons does not output as coded. Can anyone let me know where did my codes go wrong? I've been searching it but i cant't find the problem. Thanks in advance. <?php if(isset($_POST['invoice_details'])) { $discountsql = "INSERT INTO `invoice_price` (`order_id`) VALUES ('.$order_id.') "; $conn->query($discountsql); } ?> <?php $sql2 = " SELECT order_id FROM ordered_items GROUP BY order_id WHERE order_id = '".$row[order_id]."' "; $query2 = $conn -> query($sql2); while ($row2 = $query2 -> fetch_assoc()) { ?> <div class="col-12 form-group"> <p> <?php echo $row2['order_id']; ?></p> <p class="text-success" pointer-events="none" style="font-weight: bold; font-size: 25px; text-align:center; ">Your order is confirmed !</p> <a href="order-list.php"> <input class="btn btn-block checkoutbtn" type="button" name="invoice_details" value="Go to Order Page"> </a> </div> <?php } ?>
I have a very simple page, where I use the include statement that includes my connection string. The connection string and a variables are not being passed to my test server - (WAMP). My include file is below $server = "servername"; $username = "username"; $password = ""; $database = "dbname"; $portNumber = 3308; $link = mysqli_connect($server,$username,$password,$database,$portNumber); if(!$link) { echo "cannot connet to the server"; } else { echo "This works"; } echo "Hi"; I am including this file with the following code:
include ("includes/connect.inc");
My site is not connecting to the database, and is not displaying "This works", or "Hi". Do you have any pointers on how to get this connect?
Hi all, I want to get the current page name as displayed in the URL, not neccesarily the name of the PHP script that is running. E.g. I have a PHP file 'home.php' that contains iframes that contain other PHP files such as 'frame1.php'. What I want is a script that can be run from frame1.php but that will return 'home.php' as the current page (as displayed in the URL in the browser). How do I do this? Thanks! Is there a way to have the values that are DISPLAYED by a FORM actually result in another set of VALUES actually being returned? For example, having arbitrary values displayed to the user to generate another set of values? Thanks! when I test this script on browser. This is all that I see. invalid username or password Code: [Select] <?php //start session session_start(); include 'functions.php'; if (loggedin()) { header("Location: userarea.php"); exit(); } if ($_POST['login']) { //get data $username = $_POST['username']; $password = $_POST['password']; $rememberme = $_POST['rememberme']; } if (username&&$password) { $login = mysql_query("SELECT * FROM users WHERE username='$username'"); while ($row = mysql_fetch_assoc($login)) { $db_password = $row['password']; if (md5($password)==$db_password) $loginok =TRUE; else $loginok = FALSE; if ($loginok ==TRUE); { if($rememberme=="on") setcookie("username",$username, time()+7200); else if ($rememberme=="") $_SESSION['username']=$username; header("Location: userarea.php"); exit(); } } } else { die("invalid username or password"); } ?> <form action="login.php" method="POST"> username:<br /> <input type="text" name="username" /><br /> password:<br /> <input type="password" name="password" /><br /> <input type="checkbox" name="rememberme">remember me<br /> <input type="submit" name="login" value="Log in" /> </form> Hey All, As of this morning our gallery has started to show the incorrect dates. Please go to: http://www.nightlifeguestlist.com/c...n/74/Carbon.htm you will see the first date is Fri, 29 October 10 this should be Sat, 30 October 10. In the database the date is in putted as 2010-10-30. The dates from Fri, 29 October 10 to Fri, 2 April 10 are all incorrect. These happen to be all BST times. While the dates for GMT are OK. The clocks here in the UK are now GMT and not BST. Has this anything to do with it? The code used is as follows: <? $location = false; if(isset($_GET['l'])){ $location = $_GET['l']; } $venue = false; if(isset($_GET['v'])){ $venue = $_GET['v']; } $event = false; if(isset($_GET['e'])){ $event = $_GET['e']; } $page = 0; if(isset($_GET['p'])){ $page = $_GET['p']; $page--; } $query_events = ""; if(!$location){ $query_events = "SELECT ec_venues.location FROM ec_venues GROUP BY ec_venues.location"; } else if($location && !$venue && !$event){ $query_events = "SELECT ec_venues.venue_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_venues.venue_id, ec_events.event_id,ec_venues.location FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_events.event_date IS NOT NULL AND ec_venues.location='".$location."' ORDER BY UNIX_TIMESTAMP(ec_events.event_date) DESC LIMIT 0,1"; } else if($venue && !$event){ $query_events = "SELECT UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_venues.venue_name, ec_venues.venue_id, ec_events.event_id, ec_events.event_name,ec_venues.location FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_venues.venue_id=".$venue." ORDER BY UNIX_TIMESTAMP(ec_events.event_date) DESC"; } else if($venue && $event){ $query_events = "SELECT ec_venues.venue_name, ec_events.event_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_events.image_folder, ec_venues.images_per_page,ec_venues.location FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_events.event_id=".$event." AND ec_venues.venue_id=".$venue.""; } mysql_select_db($database_nightlife2 , $nightlife2 ); // $query_events = "SELECT ec_venues.venue_name, ec_events.event_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_events.image_folder, ec_venues.images_per_page FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ec_events.event_id=".$event." AND ec_venues.venue_id=".$venue.""; //echo $query_events; $events = mysql_query($query_events, $nightlife2 ) or die(mysql_error()); $row_events = mysql_fetch_assoc($events); $totalRows_events = mysql_num_rows($events); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?=(!$location?"Elite Parties Photos":"Nightlife Guestlist @ ".$location." Club - ".$row_events['venue_name'])?></title> <link href="http://www.nightlifeguestlist.com/wp-content/themes/NLGL/style.css" rel="stylesheet" type="text/css" /> <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="http://www.nightlifeguestlist.com/wp-content/themes/NLGL/IE-6.css" /> <![endif]--> <!--[if IE]> <link rel="stylesheet" type="text/css" href="http://www.nightlifeguestlist.com/wp-content/themes/NLGL/IE-8.css" /> <![endif]--> <? if($_SERVER['HTTP_HOST']=="elite"){?> <BASE HREF="http://elite/"> <? } else { ?> <BASE HREF="http://www.nightlifeguestlist.com/"> <? } ?> <SCRIPT language="JavaScript" src="/mircoFinestra.js"></script> <script src="/AC_RunActiveContent.js" type="text/javascript"></script> </style> </head> <body> <div class="wrapper"> <div id="head"> <div id="header"> </div> <!-- nav --> <div id="nav"> <div id="nav-area"> <ul> <li class='page_item current_page_item'><a href='http://www.nightlifeguestlist.com' title='Home'>Home</a></li><li class="page_item page-item-3"><a href="http://www.nightlifeguestlist.com/guest-lists" title="Guest Lists">Guest Lists</a></li> <li class="page_item page-item-5"><a href="http://www.nightlifeguestlist.com/photogallery.php" title="Photo Gallery">Photo Gallery</a></li> <li class="page_item page-item-7"><a href="http://www.nightlifeguestlist.com/video-gallery" title="Video Gallery">Video Gallery</a></li> <li class="page_item page-item-9"><a href="http://www.nightlifeguestlist.com/jobs" title="Jobs">Jobs</a></li> <li class="page_item page-item-11"><a href="http://www.nightlifeguestlist.com/membership" title="Mailing List">Mailing List</a></li> <li class="page_item page-item-16"><a href="http://www.nightlifeguestlist.com/tables" title="Tables">Tables</a></li> <li class="page_item page-item-13"><a href="http://www.nightlifeguestlist.com/event-management" title="Event Management">Event Management</a></li> <li class="page_item page-item-538"><a href="http://www.nightlifeguestlist.com/blog" title="Blog">Gossip Blog</a></li> </ul> </div> </div> <!-- end nav --> <div class="clear"></div> </div> <!--/head --> <div class="narrowcolumn"> <div class="entry"> <div id="content-area"> <!-- 1 --> <div id="section"> <? if($venue && !$event){ ?><?php $pCount = 0; $myNum = sprintf("%02d",$venue); echo "<img src='interiors/" . $myNum . "_logo.gif' vspace='2' hspace='2'>\n"; if ($handle = opendir('interiors')) { while (false !== ($file = readdir($handle))) { if (substr($file,0,6) == $myNum . "_pic") { echo '<img src="interiors/' . $file . '" vspace="2" hspace="2">'; if($pCount++ % 2 == 1) echo ""; } } closedir($handle); } ?> <? } ?> <? if(!$location){?> <!-- 2 --> <div id="section"> <? do{ $query_latest = "SELECT ec_venues.venue_name, UNIX_TIMESTAMP(ec_events.event_date) AS event_date, ec_venues.venue_id, ec_events.event_id FROM ec_events INNER JOIN ec_venues ON ec_events.venue_id = ec_venues.venue_id WHERE ((ec_events.event_date) IS NOT NULL) AND ec_venues.location='".$row_events['location']."' ORDER BY UNIX_TIMESTAMP(ec_events.event_date) DESC LIMIT 0,1"; $latest = mysql_query($query_latest, $nightlife2 ) or die(mysql_error()); $row_latest = mysql_fetch_assoc($latest); $totalRows_latest = mysql_num_rows($latest); ?> <a href="club_dates/<?=$row_events['location']?>/<?=$row_latest['venue_id']?>/<?=$row_latest['event_id']?>/<?=str_replace(" ","_",$row_latest['venue_name'])?>_page1.htm "><?=$row_events['location']?> - <?php echo date("l jS F",$row_latest['event_date']); ?> @ <?php echo $row_latest['venue_name']; ?></a><br> <? } while ($row_events = mysql_fetch_assoc($events)); mysql_free_result($latest); ?> </div> <!-- 3 --> <div id="section"> <? } else if(!$venue){ ?> </div> <!-- 4 --> <div id="section"> Our most recent event was <strong><a style="color:#000000; font-weight:bold;" href="club_dates/<?=$row_events['location']?>/<?=$row_events['venue_id']?>/<?=$row_events['event_id']?>/<?=str_replace(" ","_",$row_events['venue_name'])?>_page1.htm "><?php echo date("l jS F",$row_events['event_date']); ?> @ <?php echo $row_events['venue_name']; ?></a></strong> <? } else if($venue && !$event){?> </div> <!-- 5 --> <div id="section"> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="10"> <tr> <td colspan="4"><? if($totalRows_events==0){ ?> No photos are avaliable yet for this venue. <? } else { ?> Select a Date for <?php echo $row_events['venue_name']; ?> <? } ?> </td> </tr> <? $count = 0; do { if($count % 3 == 0){ echo '<tr>'; } ?> <td width="713"><a style="color:#000000; font-weight:bold;" href="club_dates/<?=$location?>/<?=$venue?>/<?=$row_events['event_id']?>/<?=str_replace(" ","_",$row_events['venue_name'])?>_page1.htm"><? echo ($row_events['event_date']==""?$row_events['event_name']:date("D, j F y",$row_events['event_date'])); ?></a></td> <?php if($count % 3 == 2){ echo "</tr>"; } $count++; } while ($row_events = mysql_fetch_assoc($events)); echo str_repeat("<td> </td>",4-($count % 4)); ?> </table> </div> <!-- 6 --> <div id="section"> <? } else if($venue && $event){ ?> </div> <!-- 7 --> <div id="section"> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td><? if ($dir = @opendir("photos/".$row_events['image_folder'])){ while (($file = readdir($dir)) !== false) { if(substr($file,0,4) == "page"){ $dirlist[] = $file; } } sort ($dirlist); reset ($dirlist); closedir($dir); } if ($dir = @opendir("photos/".$row_events['image_folder']."/".$dirlist[$page])){ while (false !== ($file = readdir($dir))) { if(substr($file,-3)=="jpg"){ $imglist[] = $file; } } usort($imglist,"strnatcmp"); reset ($imglist); closedir($dir); } $count = 0; $paging = ""; if($page==0){ $paging .= "<< "; } else $paging .= "<a href='/club_dates/".$location."/".$venue."/".$event."/".str_replace(" ","_",$row_events['venue_name'])."_page".($page).".htm' style='color:#000000; font-weight:bold;'><<</a> "; foreach($dirlist as $f){ if($page!=$count){ $paging .= "<a href='/club_dates/".$location."/".$venue."/".$event."/".str_replace(" ","_",$row_events['venue_name'])."_page".($count+1).".htm' style='color:#000000; font-weight:bold;'>".($count+1)."</a> "; } else { $paging .= ($count+1)." "; } $count++; } if($page==count($dirlist)-1){ $paging .= ">> "; } else $paging .= "<a href='/club_dates/".$location."/".$venue."/".$event."/".str_replace(" ","_",$row_events['venue_name'])."_page".($page+2).".htm' style='color:#000000; font-weight:bold;'>>></a>"; ?></td> </tr> <tr> <td><? echo "<table width='720'><tr><td>Nightlife Guestlist @ ".$row_events['venue_name'].($row_events['event_date']!="" ?" - ".date("l jS F Y", $row_events['event_date']) : "")." - ".$location."</td><td align='right'>".$paging."</td></tr></table>\n"; ?></td> </tr> <tr> <td><? for($count=0;$count<count($imglist);$count++){ echo "<a href='javascript:;'><img alt='".$imglist[$count]." @ ".$location." Club ".$row_events['venue_name'].", ".date("jS F Y", $row_events['event_date'])."' border='0' width='90px' height='60px' hspace='5px' vspace='5px' src='"."photos/".$row_events['image_folder']."/".$dirlist[$page]."/thumbs/".$imglist[$count]."' onclick='NewWindow(\"/popup.php?t=".count($imglist)."&n=".$count."&f=".$row_events['image_folder']."&p=".$dirlist[$page]."&title=".urlencode($location." Club ".$row_events['venue_name']." on ".date("jS F Y", $row_events['event_date']))."\",\"name\",\"600\",\"420\",\"no\");return false;'></a>\n"; if($count % 7 == 6){ echo "<br>\n"; } } ?> <? } ?></td> </tr> <tr> <td> </td> </tr> </table> </div> <div id="section"> <? if(!$location){ ?> <? } else { include("getClubLogos.php"); } ?> (Sorry for the amount of code!) I use the same code for another site on another server and it works fine. I guess I need to alter the code somehow? The gallery works ok just the dates show are wrong. Any ideas on how to fix this? The server settings/time seems are OK. The line which prints the date is:<? echo ($row_events['event_date']==""?$row_events['event_name']:date ("D, j F y", $row_events['event_date'])) ; ?> When I echo the date echo date('c'); I receive 2010-10-29T23:00:00+00:00 for Fri, 29 October 10. Thanks I've spent the past 2 days googling and trying different methods that people have recommended other people try yet still I come up with the same problem. I am new to coding and I am learning the basic functions so all feedback is welcome in aiding my learning endeavor. I am using a form and all of the inputs are submitting to the database other than the text area which comes up blank. I do not get an error when submitting the form I just get a blank value for the text area 'Comments'.
FORM
<form action="contactdb.php" method="post" form="contactdb"/> Hi to everyone , I have used PHP for some basic things in my previous website design but am now venturing into another website for which I have a more complex use for PHP. I plan on making business directory for my local area. People will click on the area of their choice followed by the business type that they require. Then on the results page, they will have a list of all the business types in that particular area. What I would like to be able to do is rather than have the results displayed on the page like this : A Plumber xxxxx xxxxxx Tel: xxxxx xxxxxx Web: xxxxx xxxxxx E-Mail: xxxxx xxxxxx Best Plumber xxxxx xxxxxx Tel: xxxxx xxxxxx Web: xxxxx xxxxxx E-Mail: xxxxx xxxxxx Top Plumber xxxxx xxxxxx Tel: xxxxx xxxxxx Web: xxxxx xxxxxx E-Mail: xxxxx xxxxxx I would like it so that the same businesses are displayed on the page but either: 1) In a random order each time someone loads the page or 2) In a random order changed every hour The aim is so the businesses all have a shot at appearing nearer the top and aren't penalised for the 1st letter of their company name. Any help on this would be much appreciated, Thank You I am working on a Contact Form in my .php file. I have always worked with loose doctypes, however, today I am using strict. I have my php above my html, and none of the code runs. Instead, it just displays some of the Echos to the page (these aren't even called yet). Also, in my form, I have the following: <INPUT NAME="Name" SIZE="30" value="<?php echo $Name; ?>"> On the page inside the field, it is displaying: <?php echo $Name; ?> What is going on here and how can I fix this issue? Yes, the pages are .php Here is the doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Any input appreciated I have the code below: ---------------------------------------------------------------------- ------------------------------------ <div id="content"> <table width="998" border="0" cellspacing="4" id="stuff"> <?php do { ?> <tr> <td><?php echo $row_Recordset1['name']; ?></td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> <div id="spryTable" spry:region="ds1"> <table align="center"> <tr> <th spry:sort="name"> </th> </tr> <tr spry:repeat="ds1" spry:setrow="ds1" spry:hover="hover" spry:select="selected"> <td height="40" align="center">{name}</td> // green line <td height="40" align="center">{name}</td> //orange line </tr> </table> </div> ---------------------------------------------------------------------- -------------------------------- At the moment the green line of code will display the entire record of names, and the orange line displays the entire record again in another column of the table. The problem is, I want half the names to be printed in one column and the other half of names to be displayed in the other column. Can someone show me how to set the php code to do this? I've been trying various things for a while now without success. Thank you. Hiya all, I'm currently trying to develop my own website / forum for a gaming guild. This is the first time I've used background images for <div>'s instead of just using a background color. I'm running into an issue, that I'm not quite sure how to solve. Since I am using a background image for my "page"; eventually, if there is too much text, the text just runs over the background image. I'd like to use some coding logic to figure out when my text would start to over run the image, and when that would happen instead create another copy of my background image below the first and start filling data there. Since I plan on using this as a forum the amount of information is not going to be static. Some people might have a few lines of text, other a wall of text, so I can't really limit it to only 4 posts and than a new page. In theroy here is what I would like to happen.... Say I have 1500 pixels before I start to over run my background image. 1) Create my first div and fill with info. 2) Check height of div, store it in a variable. 3) Create second div. 4) Check height of that div, store it in the same variable. 5) Check to make sure that my variable doesn't exceed 1500px. If it does than I need to create my second page and start filling info there... I hope I am explaining this to where it is understandable. Here is a link to the site I am working on: http://98.249.189.188/guildwars/forum/view_topic.php?id=9 Currently, I am pumping out each reply in this fashon: Code: [Select] <?php while($row_rply = mysql_fetch_array($results_rply)) { echo "<div class=\"replies\";"; echo "<p>".nl2br($row_rply[0])."</p>"; echo "<p class=\"small\">By: $row_rply[1] on $row_rply[2]</p>"; echo "</div><br />"; } include('reply.php'); ?> Hello, I have a stock page on my site and want to use the code to display a small stock area on my home page. I am not sure on how I would limit the number of records or randomize the records shown. The code is Code: [Select] <?php $coachselect=mysql_query("SELECT * FROM coaches WHERE DISPLAY = '1' ORDER BY STOCK")or die(mysql_error()); while($row = mysql_fetch_array($coachselect)){ ?> <ul class="stock-home"> <li><h4><a href="details-id-<?php echo $row['ID']; ?>.html" target="_blank"></a></h4></li> <li><img src="./<?php echo $row['IMAGES'] . "/" . $row['DEFAULT_IMAGE'] ; ?>" width="187" height="138" alt="lehel virage for sale" class="fl"/></li> <li><?php echo $row['NAME']; ?></h3></li><li><?php echo $row['DESC_SHORT']; ?></li> <li><a href="details.php?id=<?php echo $row['ID']; ?>" target="_blank">more info...</a></li> <li><?php echo $row['DESC_2']; ?></li> </ul><!--close stock home--> <?php } ?> I am guessing that something needs to be added here Code: [Select] $coachselect=mysql_query("SELECT * FROM coaches WHERE DISPLAY = '1' ORDER BY STOCK")or die(mysql_error()); while($row = mysql_fetch_array($coachselect)){ ?> But am not sure how to do it? Does anyone have any advice or could point me to a tutorial? Here is the rest of the code, from the top of the page. Code: [Select] $CON=mysql_connect($DB_SERVER, $DB_USER, $DB_PASS) or die(mysql_error()); $DB_SELECT=mysql_select_db($DATABASE) or die(mysql_error()); if (isset($_POST)) { foreach ($_POST as &$value) { $value = trim(htmlspecialchars($value, ENT_QUOTES)); } } if (isset($_GET)) { foreach ($_GET as &$value) { $value = trim(htmlspecialchars($value, ENT_QUOTES)); } } $_SERVER['PHP_SELF'] = filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_STRING); ?> Many Thanks Dan |