PHP - What Mode Should Mysql Be Running In When Used With Php?
My my.cnf file has three sections (mysqld, mysqld_safe, mysql). It seems that they represent different modes which MySQL runs in. Is this correct? I read that some recommend running in safe mode. Should I be if it is being used to support PHP? I typically start MySQL as "service mysqld start" when running Centos. How should I be starting it if I want it in safe mode.
Similar Tutorialswhy is this code not working? in php i have the following...
$keywords = "+hello +world"; $query= "SELECT * FROM forums WHERE MATCH (topics) AGAINST ('$keywords' IN BOOLEAN MODE)"; $results = mysqli_query($database, $query); $row = mysqli_fetch_assoc($results); $topics = $row['topics']; echo $topics; Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given... Hey, I am a bit of a noob at php/mysql and trying to be clever(emphasis on trying). I want to pull some php/html code from a database in mysql, whilst it does display the html, the php does not. Can this even be done? Is it going to cause me issues later on? Code: [Select] [php] <?php $query = "SELECT * FROM pages"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ $body = $row["body"]; echo $body; }?> [/php] Any help would really be appreciated. Ell Hi i was wondering what im doing wrong, im trying to insert a query for submit button, it works if i run it straight in mysql, but not working when linked through php. Im just doing it for testing purpose right now only, so when i see that it works i will use another query. here it is Code: [Select] <?php include('config.php'); if($_SESSION['username']){ if(isset($_POST['ASubmit'])){ $query3=("update country set Status='test1' where Uname='Mclovin'");} echo '<td><form name="test" method="post" form id="form1"><label for="test">Status</label> <select name="Status"> <option value="">-----</option> <option value="In process" '.(($row['Status']=='In process')?'selected="selected"':'').'>In process</option> <option value="Approved" '.(($row['Status']=='Approved')?'selected="selected"':'').'>Approved</option> <option value="Denied" '.(($row['Status']=='Denied')?'selected="selected"':'').'>Denied</option> </select><input name="ASubmit" type="submit" value="Update">'; echo $row{'Status'}.'</td></form>'; } ?> I am trying to create a calendar of Events for my company's website. When I search for this type of calendar, I can find code that runs the calendar from one Events table. However, we could have an Event that has multiple performances. (For example, Lily Tomlin could be performing at the Atwood Concert Hall in Anchorage on 09/09/11 and at the Vagabond Blues in Palmer on 09/10/11.) So we have two tables to draw the information from: Events and Performance I can successfully create a MySQL query (see below) with PHP coding that will make a listing (as demostrated on our website http://www.centertix.net/). Code: [Select] "SELECT Events.PublishDate, Events.EventOnSaleDate, Events.BldgContractDate, Events.SetUpComplete, Events.EventTitle, Performance.PerfID, Performance.startDateTime, Performance.endDateTime, Performance.PerfType, venues.VenueName, venues.VenueCode FROM (Performance RIGHT JOIN Events ON Performance.EventID = Events.EventID) LEFT JOIN venues ON Performance.VenueCode = venues.VenueCode WHERE Events.BldgContractDate Is Not Null AND Events.SetUpComplete Is Not Null AND Performance.PerfType='Public Event'"However, I'm not advanced enough to create the if-clause or while-loop to check to see if the Performance.startDate = the calendar's date and then place the info into the appropriate calendar grid box. I think have determined where it should be place in my PHP code, but need help getting the calendar to work. Here's the code where I think it should go: Code: [Select] for($list_day = 1; $list_day <= $days_in_month; $list_day++): if(($list_day == date("j",mktime(0,0,0,$this->month))) && (date("F") == date("F",mktime(0,0,0,$this->month))) && (date("Y") == date("Y",mktime(0,0,0,$this->month,$list_day,$this->year)))) { $this->calendar.= '<td class="'. $this->style .'-current-day">'; } else { if(($running_day == "0") || ($running_day == "6")) { $this->calendar.= '<td class="'. $this->style .'-weekend-day">'; } else { $this->calendar.= '<td class="'. $this->style .'-day">'; } } /* add in the day number */ $this->calendar.= '<div class="'. $this->style .'-day-number">'.$list_day.'</div>'; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $this->calendar.= '<div class="'. $this->style .'-text"><a href="">PERFORMANCE INFO</a></div>'. "\n"; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF NO MATCHES FOUND, PRINT NOTHING !! **/ $this->calendar.= str_repeat('<p> </p>',2); $this->calendar.= '</td>'; if($running_day == 6): $this->calendar.= '</tr>'; if(($day_counter+1) != $days_in_month): $this->calendar.= '<tr class="'. $this->style .'-row">'; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; Please help me plug the calendar in with the appropriate events! If you would like to see how far I have gotten, you can check out this link: http://www.myalaskacenter.com/calendars/calendarSample2.php Hi All, I have a form that enables the user to know events that occur in a specific city. Most of the time they get the results in a few seconds, despite the fact that many rows in various tables might be searched for detailed infos about the events in that city. However, this form partly relies on a table against which a MySQL event regularly does some operations. If the user uses the form while the event is being executed, they have to wait up to 30 seconds before getting the results, and sometimes only part of the html page is generated. Is there a way to avoid this lengthy waiting time ? I am wondering whether or not the best would be putting the site on maintenance while the event is being executed, with a "please come back in a few minutes" message. Thanks in advance for your help. I am creating a site to display some products. For ease of updating I want it to run off a MySQL database. I have created the database and php scripts to output and input data etc. I know want to show that data in my web pages. My question is.... Is it best to insert HTML into the php output script to display the information and make the site look how I want....OR ....... should I create a template of the site in HTML and then somehow call the php output script (and the particular row of the database...) Basically... should I put the html code into the php - OR - put the php into the HTML?? I hope this make sense...... thanks <script> //Calculate Labour function filllabour(aa) { //Parse aa var the_string = aa; var parts = the_string.split('-', 2); // After calling split(), 'parts' is an array with two elements: // parts[0] is 'left or -' // parts[1] is 'right of -' var the_text = parts[0]; var the_num = parts[1]; //Parse aa var dblQuantity = document.getElementById('lqlabour-' + the_num).value-0; var curRate = document.getElementById("llabour-" + the_num).value-0; var curRateHelper = document.getElementById("lhelper-" + the_num).value-0; var dblMarkup = document.getElementById("lmarkup-" + the_num).value-0; var curTotal = parseFloat(dblMarkup) / 100.0; llinetotal = ((dblQuantity * curRate) + (dblQuantity * curRateHelper)) * (1 + curTotal); llinetotal = llinetotal.toFixed(2); document.getElementById("ltotal-" + the_num).value = llinetotal; //document.getElementById(the_num).value = ("test"); //alert(the_num); //collect all line totals var inputs = document.getElementsByName("ltotal[]"); var laboursubtotal = 0; for (var i = 0.00; i < inputs.length; i++){ if (inputs[i].type = "text"){ laboursubtotal += parseFloat(inputs[i].value, 10); } } //collect all line totals laboursubtotal = laboursubtotal.toFixed(2); document.getElementById("labourtotal").value = laboursubtotal; filltotal(); } //Calculate Labour </script>hi, in ie11 we are forced to use compatibility mode for one of our web applications written in php. above is a script that from what I understand is the error is with getElementsByName. any suggestions for me in ie11? I'm not a programmer, so sometimes the php.net/manual reads like a foreign language to me. I have a quick interpretation question: I'm generating data in PHP for a MySQL stored procedure that has two comma separated value inputs. The second input is always a series of 0's and 1's. I'm trying to count the number of 1's for the second input (in the example below, it would be "3"). Example input sent to MySQL:$query_resolve = "CALL spParticipant_Test ('188,216,342,81,117,56','0,1,1,0,0,1')"; http://www.php.net/manual/en/function.count-chars.php is mostly helpful, but I am hoping for clarification on the mode I want to run. Quote Depending on mode count_chars() returns one of the following: 0 - an array with the byte-value as key and the frequency of every byte as value. 1 - same as 0 but only byte-values with a frequency greater than zero are listed. 2 - same as 0 but only byte-values with a frequency equal to zero are listed. 3 - a string containing all unique characters is returned. 4 - a string containing all not used characters is returned. Do I want to run mode "1"? Thanks so much for any feedback! Hello,
How can I create a webpage using HTML and have a div wrapper for the page become FULL SCREEN?
I'm guessing this would be done with Javascript.
CREATE TABLE user (username varchar(20),password varchar(20),level varchar(20),PRIMARY KEY(username)); INSERT INTO `user` VALUES ('a', 'pass1', 'admin'); INSERT INTO `user` VALUES ('b', 'pass2', 'admin'); INSERT INTO `user` VALUES ('c', 'pass3', 'user'); This is my database and Registration.php Code: [Select] <html> <head> <script type="text/javascript"> function a() { var x = document.register.username.value; var y = document.register.pass.value; var z = document.register.pass2.value; if(x==""&& y==""&& z=="") { alert("Please insert all message!"); return false; } if(x=="") { alert("Please insert an username!"); return false; } if(y=="") { alert("Please insert an password!"); return false; } if(z=="") { alert("Please insert an password2!"); return false; } if (y!=z) { alert("Your passwords did not match"); return false; } } </script> </head> <?php mysql_connect("localhost","root") or die(mysql_error()); mysql_select_db("cute") or die(mysql_error()); if (isset($_POST["sub"])) { $_POST['pass'] = md5($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); $_POST['pass'] = addslashes($_POST['pass']); } $usercheck = $_POST["username"]; $check = mysql_query("SELECT username FROM regis WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('Sorry, the username" ." ".$usercheck." ". "is already in use.')</SCRIPT>"); echo ("<SCRIPT LANGUAGE='JavaScript'>setTimeOut(window.location = 'registration.php',1)</script>"); } else if($_POST['username'] && $_POST['pass'] && $_POST['pass2'] ) { $insert = "INSERT INTO regis(username, password) VALUES ('".$_POST['username']."', '".$_POST['pass']."')"; $add_member = mysql_query($insert); echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('Registration had been succesfully added :)')</SCRIPT>"); echo "<meta http-equiv='refresh' content='0; url=login.php'>"; } } ?> <body> <form name="register" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return a()"> <table border='0'> <tr><td>Username:</td><td><input type="text"name="username" maxlength="60"></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="10"></td></tr> <tr><td>Confirm Password:</td><td><input type="password" name="pass2" maxlength="10"></td></tr> <tr><th colspan=2><input type="submit" name="sub" value="Register"></th></tr></table> </form> </body> </html> My main problem when in registration iam did not put user level field because it is not secure but how to manage or how to detect when someone registering he or she is user or admin? Hey all Im trying to find a way to combine images but set the blend mode, like in Photoshop, selecting how layers are blended together. I have looked at all the docs for GD with no luck... Cheers in advanced Maca134 Hello, forgive me for this question in advance. I have looked all day for a fix to this and nothing I have come across has resolved this. My host upgraded to the most recent PHP several months ago and since it has thrown errors on certain scripts. I have gotten tired of looking at them and haven't been able to find a fix on my own so here I am. I am getting the below error.
Notice: Undefined index: mode in /home4/mesquiu0/public_html/NSDisplay/NSStorms-include.php on line 38
if ($_REQUEST['mode'] == 'expired') { // We only want the expired storms $filetoRead = $expiredfile; $arraytoUse = $Expired; } else { $filetoRead = $stormfile; $arraytoUse = $Active; }I am pretty sure it needs an inset call but not sure how to go about formatting that as I have done with the others errors I have come across. Any suggestions to this error? -Thanks! can we set limit in safe mode as the hosting company would not off the safe mode so please help i get following error, Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode in /home/evercash/public_html/5dollarmatrix.co.cc/admin.php on line 190 elseif($b=="Compress Matrix") { set_time_limit(6000); include "config.php"; hey i was hoping to add a checkbox to my upload form on my site how would i accomplish something like this set to mature [checkbox here] Not sure at all if this is the right place for this post, but it seemed the most applicable spot. Mods, please move this thread if it is more appropriate elsewhere.
OK - We've got a client that's using - as far as I can tell - exclusively IE11 and has been running into an issue where IE is apparently deleting the contents of the 'Compatibility View Settings' when the browser is closed and/or the browsing history is cleared. According to the research I've done, this was a design decision by Microsoft when they updated IE to only display the 'broken page' icon when the browser thinks the page is broken (regardless IE's actual ability to correctly parse the page) and is fairly well documented in several different places on the Interwebs.
So, I know the issue, and I know that adding an "X-UA-Compatible" meta-tag in the target page's HTML should take care of the problem. The issue I'm having is this - we're redoing the site. Unfortunately, we're not redoing the pages that are causing the current problem, and the client has talked with someone who made mention of (rough quote here) 'a small bit of code that could be added to the link' that would force IE to render in compatibility mode.
I'm assuming the client's source is talking about the meta-tag in the link target page, and I haven't found anything in my Google searches to discount that theory, but I thought I'd ask here before I spoke with them about it in case I'm wrong.
Is there a flag that I can simply append to the URL that IE will parse and force a specific release-compatible view? Or really any way to force IE to render a webpage to a certain version that doesn't entail messing up the display to every other browser ever made or modifying the rendered page's source HTML?
i m using code for sending email through GMAIL SMTP as given below... can any one tell me that how i can send EMAIL through Centos 5 CLI mode.... i which folder places i save my PHP files or any other supporting files etc. in graphical mode we use webbrowser but in Command line how i can use this project.... and also please tell me how i can run firefox in CLI mode..... i m a new user of PHP and linux, please guide me in easy way. <html> <head> <title>PHPMailer - SMTP (Gmail) advanced test</title> </head> <body> <?php require_once('/var/www/PHPMailer_v5.1/class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch $mail->IsSMTP(); // telling the class to use SMTP try { $mail->Host = "smtp.gmail.com"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "john@gmail.com"; // GMAIL username $mail->Password = "password"; // GMAIL password //$mail->AddReplyTo('name@yourdomain.com', 'First Last'); //$mail->AddAddress('user1@gmail.com', 'user1'); //Set Send To Address $mail->AddAddress('receiveremail@gmail.com', 'user2'); //Set Send To Address $mail->SetFrom('senderemail@gmail.com', 'senderemail Name'); // Set Send From Address //$mail->AddReplyTo('name@yourdomain.com', 'First Last'); $mail->Subject = 'Email with Attachment with PHP is done'; $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically $mail->MsgHTML(file_get_contents('contents.html')); $mail->AddAttachment('/images/asdf.pdf'); // attachment $mail->AddAttachment('/images/asd.wav'); // attachment $mail->Send(); echo "Message Sent OK</p>\n"; } catch (phpmailerException $e) { echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e->getMessage(); //Boring error messages from anything else! } ?> </body> </html> i run several wordpress on domains - and wthin the wordpress i have a plugin that allows uploads of images -within a certain plugin the interesting thing: image upload is - sometimes possible and sometinmes impossible: see here the circumstances - PHP Version : 5.3.28 PHP Safe Mode : On image upload is impossible - and on the same server - a second vhost PHP Version : 5.3.28 PHP Safe Mode : off image upload is possible why is this so - does it have to do with the safe-mode - fulltext in boolean mode is not matching ignored words in mysql.
ENGINE is set for myisam. mysql collation is utf8_general_ci.
i have altered table using...
ALTER TABLE users ADD FULLTEXT(userName);when i view mysql indexes, userName is username instead. I am not sure if this matter as there is not an error message when searching. SELECT * FROM users WHERE MATCH (userName) AGAINST ('$keywords' IN BOOLEAN MODE)I have restarted mysql and still does not match some 5 character words. in the mysql config, word length is set to 4. have i missed something? I was looking at the manual:
http://php.net/manua...ction.fopen.php
And I noticed the the binary mode 'b' is missing from the list. Any reason why?
|