PHP - Slide Show Help
The school district that I work for has been using a slide show PHP script that I designed, which uses random images from a database. I have now been asked to build in an option where they can enter text into the database and the script takes the text and either creates an image that is 1000pixels wide and 700 pixels tall with the text filled in the image or it just have the text re-sized to fit a text box with the same dimensions as above, so the students can see the text displayed from down the hall on the monitors. I would also like the script to have the ability to explode the text so the words can stay large in case of the user entering a long winded entry. Thank you in advance for any help.
Similar TutorialsI am looking for help on guiding me to a way for a user to upload a group of pictures for a slide show. can some one help? I have a news page that a user is able to upload new stories or edit and upload one photo, but now i want that user to upload a group of pictures for a slideshow. hope all this makes sense. I want to show a cookie of a referral's username on a sign up page. The link is like this, www.mysite.com/signup?ref=johnsmith. The cookie doesn't show if I go to that url page. But it does show up once I reload the page. So I'm wondering if it's possible to show the cookie the first time around, instead of reloading the page? Here is my code. // This is in the header $url_ref_name = (!empty($_GET['ref']) ? $_GET['ref'] : null); if(!empty($url_ref_name)) { $number_of_days = 365; $date_of_expiry = time() + 60 * 60 * 24 * $number_of_days; setcookie( "ref", $url_ref_name, $date_of_expiry,"/"); } else if(empty($url_ref_name)) { if(isset($_COOKIE['ref'])) { $user_cookie = $_COOKIE['ref']; } } else {} // This is for the sign up form if(isset($_COOKIE['ref'])) { $user_cookie = $_COOKIE['ref']; ?> <fieldset> <label>Referred By</label> <div id="ref-one"><span><?php if(!empty($user_cookie)){echo $user_cookie;} ?></span></div> <input type="hidden" name="ref" value="<?php if(!empty($user_cookie)){echo $user_cookie;} ?>" maxlength="20" placeholder="Referrer's username" readonly onfocus="this.removeAttribute('readonly');" /> </fieldset> <?php }
I am displaying rows from a database onto a page using: while($row=mysql_fetch_array($query)){ echo $row['name']; } I need to figure out how to limit the rows shown to the page to 100. And if there are 100 rows on the page, a link will be displayed at the bottom, that says "Next 100". Then this will display the next 100 rows. Can you give an example how to do this please? Thanks Hi , I know my code sucks but i'm learning fast!! I'm trying to show a form if the qty value in a database == 10 or a different form if the value ==20. I tried but failed. Any help really appreciated. Code: [Select] <?php require_once('Connections/book.php'); ?> <?php $colname_cardpayment = "-1"; if (isset($_GET['orderid'])) { $colname_cardpayment = (get_magic_quotes_gpc()) ? $_GET['orderid'] : addslashes($_GET['orderid']); } mysql_select_db($database_book, $book); $query_cardpayment = sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment); $cardpayment = mysql_query($query_cardpayment, $book) or die(mysql_error()); $row_cardpayment = mysql_fetch_assoc($cardpayment); $totalRows_cardpayment = mysql_num_rows($cardpayment); // Database connect $con = mysql_connect("mysql1.myhost.ie","admin_book","root123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("book_test", $con); //Parse Values from Coupon.php Form $orderid = mysql_real_escape_string(trim($_POST['orderid'])); $name = mysql_real_escape_string(trim($_POST['name'])); $surname = mysql_real_escape_string(trim($_POST['surname'])); $add1 = mysql_real_escape_string(trim($_POST['add1'])); $add2 = mysql_real_escape_string(trim($_POST['add2'])); $town = mysql_real_escape_string(trim($_POST['town'])); $county = mysql_real_escape_string(trim($_POST['county'])); $postcode = mysql_real_escape_string(trim($_POST['postcode'])); $phone = mysql_real_escape_string(trim($_POST['phone'])); $email = mysql_real_escape_string(trim($_POST['email'])); $letterstyle = mysql_real_escape_string(trim($_POST['letterstyle'])); $sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle) VALUES ('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Digital Scribe Books</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> </head> <body onload="MM_preloadImages('images/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')"> <div id="snow"> <div id="wrapper"> <div id="header"> <div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div> <div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div> </div> <div id="content"> <?php echo 'Order ID is : '. $orderid . '.<br />'; if ($row2['qty'] == 10) echo "<div> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="accounts@agraphics.ie"> <input type="hidden" name="lc" value="IE"> <input type="hidden" name="item_name" value="10 Christmas Cards"> <input type="hidden" name="item_number" value="<? echo $orderid; ?>"> <input type="hidden" name="amount" value="12.99"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="return" value="http://www.digitalscribe/thanks.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div>"; if ($row2['qty'] == 20) echo "<div> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="accounts@agraphics.ie"> <input type="hidden" name="lc" value="IE"> <input type="hidden" name="item_name" value="20 Christmas Cards"> <input type="hidden" name="item_number" value="<? echo $orderid; ?>"> <input type="hidden" name="amount" value="21.99"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="return" value="http://www.digitalscribe/thanks.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div>"; ?> </div> <div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br /> Books</div> </div></div> </div></div> </body> </html> <?php mysql_free_result($cardpayment); ?> Hi, I would like to do the following but not sure how. If the you/user is on index.php of http://www.domain.com/ show one page If not show another How would I do this? Thanks I can't understand for the life of me - why the value for the variable: $total_vit_k is 2 in the red box: http://content.screencast.com/users/rockstarvisible/folders/Jing/media/beafff1f-2168-47b8-91bb-950ace0722c2/2012-03-21_1437.png. The reason why I can't understand this is because $total_vit_k is the weekly total for everything from jan 29 to feb 4 but there's no values for those dates logged in the mysql table it's pulling from. Please help me. It should be displaying 0 Mcg in the red box but it isn't. I know it's something wrong in my code. When I echo out all the values in the while loop like below, the browser echos out nothing for the queries from jan 29 2012 to feb 4 2012. code below is from file 2: Code: [Select] while ($row = mysql_fetch_assoc($query_run)){ echo "<br /><br /><b><i>" . '$sql_food ' . $sql_food."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_total_servings ' . $sql_total_servings."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_day ' . $sql_day."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_month ' . $sql_month."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_year ' . $sql_year."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_vit_k ' . $sql_vit_k."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . ' $sql_servings ' . $sql_servings."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . ' $total_vit_k ' . $total_vit_k."</b></i><br /><br/ >"; include 'inside_while.acc-over.php'; } full code for file2: Code: [Select] <?php if(!function_exists('getWeeklyVitK') ){ function getWeeklyVitK($value, $bday, $bmonth, $byear, $eday, $emonth, $eyear){ //initialize the variables so no errors occur $query_month =$bmonth; $query_year =$byear; $query_day = $bday; //initialize variables $total_vit_k = 0; //$total_cal = 0; //$total_protein = 0; //$total_fiber = 0; //$total_carbs = 0; //$total_sugar = 0; //$total_sodium = 0; //$total_chol = 0; if ($value==1){ echo "Something went wrong - tell pavankat[at]gmail."; break; } if ($value==2){ // if $value = 2 // end day >= start day // end month = start month // end year = start year $day_temp = $eday; while($bday<=$day_temp){ $query_day = $bday; //redeclare the mysql query include 'acc-over-sql-queries.php'; if ($query_run = mysql_query($query_value2)){ while ($row = mysql_fetch_assoc($query_run)){ include 'inside_while.acc-over.php'; } } $bday++; } return round($total_vit_k, 2); } if ($value==3){ // if $value = 3 // end day and beg day don't matter // end month > beg month // end year = beg year for($bmonth; $bmonth<=$emonth; $bmonth++){ $query_month = $bmonth; $days_in_month = date('t',mktime(0,0,0,$query_month,1,$byear)); $day_temp = $days_in_month; echo "<br />day_temp variable:<u> ".$day_temp. "</u><br />"; while($bday<=$day_temp){ $query_day = $bday; //redeclare the mysql query include 'acc-over-sql-queries.php'; echo "<br />".'$query_value3:' . $query_value3 . "<br />"; if ($query_run = mysql_query($query_value3)){ while ($row = mysql_fetch_assoc($query_run)){ echo "<br /><br /><b><i>" . '$sql_food ' . $sql_food."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_total_servings ' . $sql_total_servings."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_day ' . $sql_day."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_month ' . $sql_month."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_year ' . $sql_year."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . '$sql_vit_k ' . $sql_vit_k."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . ' $sql_servings ' . $sql_servings."</b></i><br /><br/ >"; echo "<br /><br /><b><i>" . ' $total_vit_k ' . $total_vit_k."</b></i><br /><br/ >"; include 'inside_while.acc-over.php'; } } $bday++; } $bday = 1; } //return round($total_vit_k, 2); return $total_vit_k; } if ($value==4){ // if $value = 4 // end day and beg day dont matter // end month and beg month dont matter // end year > beg year for($byear; $byear<=$eyear; $byear++){ $query_year = $byear; $month_temp = 12; while($bmonth<=$month_temp){//while loop starts $query_month = $bmonth; //cycle through the days $days_in_month = date('t',mktime(0,0,0,$query_month,1,$byear)); $day_temp = $days_in_month; while($bday<=$day_temp){ $query_day = $bday; //redeclare the mysql query include 'acc-over-sql-queries.php'; if ($query_run = mysql_query($query_value4)){ while ($row = mysql_fetch_assoc($query_run)){ include 'inside_while.acc-over.php'; } } //-----------------------------------$bday++ unless stuff if ($byear < $eyear){ $bday++; }else if ($byear == $eyear){ if ($bmonth < $emonth){ $bday++; }else if($bmonth == $emonth){ if ($bday < $eday){ $bday++; }else if($bday == $eday){ $bday = $day_temp+1; } } } //-----------------------------------$bday++ unless stuff }//while day loop end $bday = 1; //-----------------------------------$bmonth++ unless stuff if ($byear < $eyear){ $bmonth++; }else if ($byear == $eyear){ if ($bmonth < $emonth){ $bmonth++; }else if($bmonth == $emonth){ $bmonth = 13; } } //-----------------------------------$bmonth++ unless stuff }//while loop ends if ($byear <= $eyear){ $bmonth = 1; } } return round($total_vit_k, 2); } } } ?> full code for the contents of the while loop: Code: [Select] <?php $sql_food = $row["name"]; $sql_year = $row["calendar_year"]; $sql_month = $row["calendar_month"]; $sql_day = $row["calendar_day"]; $sql_total_servings = $row["total_servings"]; $sql_vit_k = $row["vit_k"]; $sql_vit_k = $sql_vit_k/$sql_total_servings; $sql_servings = $row["servings"]; if ($sql_servings == 0){ $total_vit_k += $sql_vit_k; }else{ $total_vit_k += $sql_vit_k * $sql_servings; } ?> full code for the sql query getting included in the previous file: Code: [Select] $query_value3 = "SELECT foods.id, users_calendar.id, `name`, `source`,`vit_k`, `cal`,`protein`, `fiber`, `carbs`, `sugar`, `sodium`, `chol`, `total_servings`, `calendar_month`, `calendar_day`, `calendar_year`, `servings` FROM `foods` LEFT JOIN users_calendar ON foods.id=users_calendar.food_id WHERE users_calendar.user_id =". $_SESSION['user_id']." && " . $query_day . "=calendar_day && ".$query_month."=calendar_month && ".$byear."=calendar_year ORDER BY users_calendar.id"; Hi I have made a view all albums page for my website and I want it to only show 10 records. If there are more than 10 I would like a next or previous button to appear and for them to take you to the next 10 records or previous 10 records. Please can somebody show me where I can learn how to do this? I know it has something to do with msql_num_rows so I have a variable called $numrows I'll post the code I currently have here <form name="view_all_albums_frm" id="view_all_albums_frm"> <table width="793" border="0" cellspacing="5" id="all_albums_tbl" cellpadding="0"> <tr> <th scope="col">ID</th> <th scope="col">Album</th> <th scope="col">Album Description</th> <th scope="col">Edit</th> <th scope="col">Delete</th> </tr> <tr> <?php $qGetAlbums = ("SELECT * FROM albums ORDER BY `id` asc"); $rGetAlbums = mysql_query($qGetAlbums) or die(mysql_error()); $numrows = mysql_num_rows($rGetAlbums); while($AllAlbums = mysql_fetch_assoc($rGetAlbums)) { ?> <th height="26" scope="col"><?php echo $AllAlbums['id']; ?></th> <th height="26" scope="col"><?php echo $AllAlbums['album_name']; ?></th> <th scope="col"><?php echo $AllAlbums['album_description']; ?></th> <th scope="col"> </th> <th scope="col"> </th> </tr> <?php } ?> </table> </form> Hi all I have a pice of code that I want to only show the image if it's empty: Code: [Select] <?php if(!empty($node->field_img['und'][0]['filename'])); { ?> <li><img src="http://mysite.co.uk/sites/default/files/brand-images/<?php print $node->field_img['und'][0]['filename']; ?>" style="max-width:270px; text-align:center;" /></li> <?php } ?> However, it shows an image placeholder (Red cross) even when it's empty? Many thanks for your help Pete I'm going insane. whenever I select Oct, Nov, Dec from the drop down it doesn't show the corresponding month appropriately. I do this in the code and it shows 10, 11 or 12 corresponding to oct, nov, dec but then it shows no month if it's october, january if it's november or december. Help me please. echo '<br /><br /> form month var dump: '; var_dump($form_month); Code: [Select] $time = time(); $actual_month = date('m', $time); $actual_year = date('Y', $time); $word_month = date('M', $time); $word_year = date('Y', $time); if (isset($_POST['form_month']) && isset($_POST['form_year']) && !empty($_POST['form_month']) && !empty($_POST['form_year']) ) { $form_month = $_POST['form_month']; //multidimensional array but it should have only one value in it at a time I think $form_year = $_POST['form_year']; echo '<br /><br /> form month var dump: '; var_dump($form_month); //echo '<br /><br />'. $form_month['1']; $insert_month = $form_month['0']; //maybe this will work $insert_year = $form_year; }else{ $insert_month = $actual_month; $insert_year = $actual_year; } // I don't know how to convert the number 01 to Jan - so i'm doing this: $wtf_word_month = ""; switch ($insert_month) { case 1: $wtf_word_month = "Jan"; break; case 2: $wtf_word_month = "Feb"; break; case 3: $wtf_word_month = "Mar"; break; case 4: $wtf_word_month = "Apr"; break; case 5: $wtf_word_month = "May"; break; case 6: $wtf_word_month = "June"; break; case 7: $wtf_word_month = "July"; break; case 8: $wtf_word_month = "Aug"; break; case 9: $wtf_word_month = "Sep"; break; case 10: $wtf_word_month = "Oct"; break; case 11: $wtf_word_month = "Nov"; break; case 12: $wtf_word_month = "Dec"; break; } ?> <h2><?php echo $wtf_word_month ." ". $insert_year; ?></h2> <form id="form_month_changer" action="account-overview.php" method="POST"> Choose a month: <select name="form_month"> <option value="<?php echo '$insert_month'; ?>" ><?php echo $wtf_word_month; ?></option> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">Aug</option> <option value="9">Sept</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> Choose a year <input type="text" name="form_year" maxlength="4" size="4" value="<?php echo $insert_year; ?>"> <input type="submit" value="Show me the calendar"> </form> <?php echo draw_calendar($insert_month,$insert_year); ?> i am doing a little project but I get stuck on a problem. How do I show the content of my SQL database in PHP or HTML. I want it to show the title at the top, the text in the middle and maybe a price at the bottom. How do I do that? I can't seem to find a tutorial which covers only that, and I don't have the time to search each tutorial for some usefull information right now. And a second thing I want is that it will show the database in one list on a specific webpage. So people can look trough the list and find the thing they want and than click on it so they awill get directed to that item from the database. How would I show the PHP code on the website page? I'm not sure if this should be under PHP or HTML or what, but, like on the forums where you see the <?php echo 'sdfjksdf'; ?> etc. How do I make it so I can write PHP on the website? This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=320886.0 I apologize in advance for any misuse of terminology. I find that I am rather ignorant in such things. I'm working on a WordPress theme. Specifically on the part that shows the "next: link-to-next-post" and "previous: link-to-prev-post" links. Here is the code that I have: Code: [Select] <?php $nextvar=next_post_link('%link'); $prevvar=previous_post_link('%link'); ?> <?php if (isset($nextvar)) { ?> <h3>Next</h3> <p><?php next_post_link('%link'); ?></p> <? } ?> <?php if (isset($prevvar)) { ?> <h3>Previous</h3> <p><?php previous_post_link('%link'); ?></p> <? } ?> The first part intends to check if the links exist. And this works fine. However, the only output I'm getting are the values of $nextvar and $prevvar. The headers are nonexistent. What's wrong? Any help is much appreciated, and I thank you in advance. i have this code but it shows the password of the user to... Code: [Select] <?php $database="dynamicg_sites"; mysql_connect ("localhost","dynamicg_sites","boom123"); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query( "SELECT * FROM sites order by votes DESC" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "<br>\n"; print "There are $num_rows News Articles"; print "<br>\n"; print "<table width=457 border=0>\n"; print "<tr>\n"; print "<td>\n"; echo "Title:"; print "</td>\n"; print "<td>\n"; echo "Description:"; print "</td>\n"; print "<td>\n"; echo "Votes:"; print "</td>\n"; print "</tr>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=2/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; print "<br />\n"; print "<br />\n"; ?>i was wondering how do i make this only show certain columns... thanks in advance... Hi can any one help iv built a cms but when i had a page how easy is it to have a show or hide while making changes to the page many thanks for any help I have my web page in the usual document root /var/www/html folder. Say, my root folder for my website is "mypage". That is, inside "/var/www/html/mypage", I have the index.php, and other files and folders. Example: /var/www/html/mypage/css/style.css /var/www/html/mypage/members/xxx.php etc /var/www/html/mypage/pictures/111.jpg, etc. /var/www/html/mypage/index.php /var/www/html/mypage/menu.php /var/www/html/mypage/login.php etc. I want to show access forbidden (403) or files not found (404) errors. How do I catch when a user enters one of the existing folders directly on the URL bar and display appropriate message? For example: /var/www/html/mypage/ will show /var/www/html/mypage/index.php which is desired. Good. /var/www/html/mypage/pictures .... I don't want them to access this folder directly, so I want to show no permission error. /var/www/html/mypage/hogehoge ... I want to show file(s) not found error. /var/www/html/mypage/some_existing_and_valid_file.php/hogehoge I want to show file(s) not found error. I want to edit httpd.conf. All I know now is how to disable directory listing and disable or enable a specific folder. I am trying to find a generic solution. Working environment: CentOS 7, PHP 5.6 Someone with knowledge and experience, please give me some guidance. Thanks! I'm working on a simple ad server and would like to display the ads in order (not random). I'm fairly certain I can do something like this: Code: [Select] // Get the last ad id, or becomes 0 if not available $lastid = ($_GET['lastid'] == '') ? '0' : $_GET['lastid']; // Get the next ad in order, or get the first one available mysql_query("SELECT adcode FROM ads WHERE zone='$zoneid' AND id > $lastid ORDER BY id ASC LIMIT 1"); The above code would get the first ad or the next ad in order.. How do I go back to the beginning when I run out of ads to show? Hi all I know this contains a bit of JavaScript but it comes from some dynamically created pages using php which are causing it an issue. Here's my scenario. I have a DB with locations, regions, jobtitles and names in it. My users can select from the DB a specific job title or a location. This can produce a report of information from a couple of people, up to over 100 (who can still be filtered by any of the above DB columns) I want to dynamically produce some JS buttons to show / hide any sections which are irrelevant to the user. eg I select by job title, it gives me all the managers, duty managers, staff, cleaners, etc from the DB for all locations. I then want 5 buttons to be on the page, each with a different region on it. (this I can do) I can dynamically label the divs around each of the user information. The issue I have is making the buttons do what I want. So if you press a button labelled "North West" it hides all records which are not from northwest region. Here's what I have so far, I just can't seem to get the functionality right as I know very little about JS. Code: [Select] <script language=javascript type='text/javascript'> function showdiv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){//if they are 'see' divs if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.visibility="visible";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'visible'; else // IE 4 document.all.divs[i].visibility = 'visible'; } else { if (document.getElementById) divs[i].style.visibility="hidden"; else if (document.layers) // Netscape 4 document.divs[i].visibility = 'hidden'; else // IE 4 document.all.divs[i].visibility = 'hidden'; } } } </script> and then one my php has processed I get a record such as. Code: [Select] <div id='NEREGION'> <table border='1' > <tr><td colspan='4'>Glasgow </td></tr> <tr><td colspan='2' >Employee Name : **********</td><td >Employee Number : *****</td><td colspan='2'>Start Date 25th November 2002</td></tr> <tr><td colspan='3'> </td><td rowspan='3'><img src='image.php?ed=2063&y2007=1&y2008=1&y2009=0&y2010=0&y2011=0&forename=1234&surname=5436' height ='400px' width='350px'></td></tr><tr><td colspan='2'>20th June 2007</td><td> NFR Petrol Delivery - Refresher Course</td></tr><tr><td colspan='2'>2nd December 2008</td><td> Incremental Sales</td></tr></table></div> Any ideas? Why is it that only certain images come through. I made sure all extensions were there but some jpegs come through others don't some pngs not others. Any thoughts? Code: [Select] <?php $hostname='yobb'; $username='ybbb'; $password='Anbbbb!'; $dbname='b29'; $usertable='bbbb; $myconn=mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.'); if ((($_FILES["file"]["type"] =="image/gif") || ($_FILES["file"]["type"] =="image/jpeg") || ($_FILES["file"]["type"] =="image/pjpeg") || ($_FILES["file"]["type"] == "image/png")) && ($_FILES["file"]["size"]< 200000)) { if ($_FILES["file"]["error"] >0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br/>"; } else { if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo "File already exists. Choose another name."; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); } } } else { echo "Invalid file"; } $path="uploads/" . $_FILES["file"]["name"]; $name=$_POST["name"]; $state=$_POST["state"]; if (!myconn) { die ('Could not connect: ' . $mysql_error()); } $db_selected=mysql_select_db('your1729',$myconn); if (!$db_selected) { die ('Can\'t use your1729 : ' . mysql_error()); } mysql_query("INSERT INTO photo(name,photopath,state) VALUES ('$name','$path','$state')") or die(mysql_error()); mysql_close($myconn); ?> Hello dear friends Let say i've a huge database of 100,000 entries Code: [Select] my_table (id,name) and i'd like to call all the entires to be shown by this code Code: [Select] $conn = mysql_connect('localhost','USER','PASS') or die(mysql_error()); mysql_select_db('my_table',$conn); $sql = "SELECT * from my_table"; $result = mysql_query($sql,$conn); while ($row = mysql_fetch_array($result)){ $name = $row['name']; $id = $row['id']; echo $name; echo "<br>(done)<br>"; } The problem The problem that makes me almost gonna cry,it takes long time to load then it will showing names (remember my_table of 100,000 entries) all at once and sometimes it sudden shows huage amount once or even sometime it hang up. My question Is there any way that i can call it so that it showing me results one name by one name like streaming name1 (done),name2 (done),name3 (done),name4 (done),name5 (done),......etc not showing all at once i'm afraid it may needs some ajax idea or somehow i really don't know but this is important to me so your help is very useful to me. so anyone please helps me cause it would really save my hosting ram otherwise they would suspend me |