[Solved] How to insert images into a database using PHP [closed]

[ad_1] Generally the best way to do this, is to upload the file to your server, and then store the path to it in the database. File Upload: http://php.net/manual/en/features.file-upload.php You need to choose a database, MySQL is a common and free option: https://www.mysql.com/ As mentioned in comment below, (I haven’t used it before but had … Read more

[Solved] send form to php file using ajax [closed]

[ad_1] Simple… Change your HTML to this… <form id=”myform” name=”myform” method=’post’ action=””> <input name=”name” type=”text”/></br> <input name=”email” type=”text”/></br> <input name=”title” type=”text”/></br> <textarea name=”message”></textarea></br> <button id=”submitbutton”>SUBMIT</button> </form> Include Jquery library at top of page… <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js”></script> Then add this script on the page… <script> $(document).ready(function(){ $(‘#submitbutton’).click(function(e){ e.preventDefault(); form = $(“#myform”).serialize(); $.ajax({ type: “POST”, url: “yourpage.php”, data: … Read more

[Solved] How to rewrite url for Get variable in php [duplicate]

[ad_1] The .htaccess is actually only 1 half of the job. This .htaccess will achieve what you want (I think) RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC] RewriteRule ^(.+)$ index.php?request=$1 [QSA,L] This .htaccess turns all your requests into index.php?request=myurl on the background, while on the front it … Read more

[Solved] Convert x number of days to decimal year

[ad_1] Think about it… 700 days, 30 days in a month. 700/30 = 23.33 months. 12 months in a year. 23.33/12 = 1.944444… take the integer value (int)1.944444 to get 1 for the year. 23.33%12= 11.33… months. You can cast it to an int as well to get 11 Your result: 1 year, 11 months … Read more

[Solved] php code : email not send

[ad_1] Your hosting provider likely has disabled emailing to prevent its system being used for spamming. You should contact them to see if they will enable it for you. If they will not, you may want to consider using a third-party service. 1 [ad_2] solved php code : email not send

[Solved] SELECT * FROM people WHERE user_id=’$user_id’ ORDER BY time GROUP BY surname [closed]

[ad_1] The ORDER BY clause should be the last, but you have to specify fields to be aggregated. Such as: SELECT surname, count(*) FROM people WHERE user_token=’$user_token’ GROUP BY surname ORDER BY surname 1 [ad_2] solved SELECT * FROM people WHERE user_id=’$user_id’ ORDER BY time GROUP BY surname [closed]

[Solved] Form method get not working [closed]

[ad_1] You have problem in won.php at this line $res=mysql_query(“SELECT * FROM users WHERE user_id=”.$_SESSION[‘user’]); You have $_SESSION[‘user’] as string.. This must be integer OR you must add quotes: $res=mysql_query(“SELECT * FROM users WHERE user_id='”.$_SESSION[‘user’].”‘”); Or define $_SESSION[“user”] as integer by adding (int) after = where you define it. UPDATE Problem solved with teamviewer. User … Read more

[Solved] Removing leading zeros from number PHP

[ad_1] Since you provide a value in octal notation, you can cast it first into a string to simply trim the leading zero. ltrim will cast any number into a string before trimming: $month = ltrim($month, ‘0’); // string Or: $month = intval(ltrim($month, ‘0’)); // integer 3 [ad_2] solved Removing leading zeros from number PHP

[Solved] Is variable’s value back-slashing available in PHP?

[ad_1] In PHP there exist no special ../ (or any other string) that when concatenated to another string generates any string other than the combine original string concatenated with the new string. Concatenation, regardless of content of strings always results in: “<String1><String2>” = “<String1>”.”<String2>”; Nothing will not ‘erase’ prior tokens in a string or anything … Read more

[Solved] How to convert a datetime string to UTC?

[ad_1] You should look at the DateTime object and its related functions in the documentation. If your input date is already in a string format, DateTime::createFromFormat() will help you create an epoch-type integer date the object can work with. After that, it’s just getTimezone() and setTimezone(). 0 [ad_2] solved How to convert a datetime string … Read more

[Solved] php pull field with variable+string

[ad_1] Context: OP posted his code within the comments; https://pastebin.com/LM1ecp13 Solution: This line;$fetch = mysqli_fetch_array(mysqli_query($conn,”SELECT id, name, price FROM stock WHERE id=’$cart[wid]'”)); Is the problem. You are selecting id, name, price but you are missing 28price hence why you are getting the undefined index error… Your query should be “SELECT id, name, price, 28price FROM … Read more

[Solved] HTML Change login label to username after login

[ad_1] You need a simple condition if($_SESSION[‘logged_in’]){ echo $_SESSION[‘username’]; }else{ echo ‘Please login’; } When your login condition gets true set some session data or cookie data then use a condition to display content based on session or cookie 4 [ad_2] solved HTML Change login label to username after login

[Solved] in this code i want add popup box link but showing one error inside .. help me [closed]

[ad_1] Try it like this: $string = substr($string, 0, 500); $string = substr($string, 0, strrpos($string, ‘ ‘)); $string .= ‘… <a href=”#” onclick=”showAjaxModal(\” . base_url() . ‘index.php?modal/popup/readmore/’ . $row[‘categories_id’] . ‘\’)”>… Read More</a>’; You are missing the single quotes which should wrap the url inside the showAjaxModal function. 1 [ad_2] solved in this code i … Read more