812 Posted Topics

Member Avatar for jacob21

Use explode and implode and form an SQL statement: $values = explode(' ', "claim for my new mercedes"); $sql = "INSERT INTO mytable VALUES ('" . implode("','", "$values") . "')"; Or use str_replace and form an SQL statement: $sql = "INSERT INTO mytable VALUES ('" . str_replace(' ', "','", "claim …

Member Avatar for broj1
0
200
Member Avatar for tallon

I am not sure whether writing banned IP addresses in htaccess file is a good idea. You will need approprite rights to write into it and the file will grow with users visiting your site which might affect performance. Also maintaing the list (i.e removing duplicate entries) in the htaccess …

Member Avatar for diafol
0
2K
Member Avatar for neha05

Typically you would load all three divs with images of different size. One of the divs will be displayed while the other two will not. You use `display:block` for displayed div and `display:none` property for the two other divs: <div id="large" style="display:none"><img... <div id="medium" style="display:block"><img... <div id="small" style="display:block"><img... or appropriate …

Member Avatar for neha05
0
323
Member Avatar for shaidur1982

[phpacademy](https://phpacademy.org/) - learning by watching videos, various PHP forums like [Daniweb](http://www.daniweb.com) :-), [Stackoverflow](http://stackoverflow.com/questions/tagged/php), a good [book](http://www.amazon.com/Beginning-PHP5-Apache-MySQL-Development/dp/0764579665) on PHP, the [documentation](http://www.php.net/manual/en/) on the PHP.net site (comprehensive, free, but sometimes harder to get through it) and a lot of experimenting - set up LAMP or XAMP and go for it. And do …

Member Avatar for shaidur1982
0
148
Member Avatar for Priti_P

Are you starting session anywhere? If you have session_start then session variables should be available to you.

Member Avatar for broj1
0
98
Member Avatar for chaitu11

Could you be more specific. Would you like to find all the checkboxes that are clicked? That is easy to implement with the [checked selector](http://api.jquery.com/checked-selector/).

Member Avatar for broj1
0
151
Member Avatar for CarterLangley

Describe your tables in a way that you can create forms and generate queries. A simple way of doing it would be to have table fields stored in an associative array where keys would be field names and values would be field types. That way you can tell whether to …

Member Avatar for CarterLangley
0
183
Member Avatar for rajendher

This is what uncle Google told me: http://www.php.net/manual/en/function.id3-get-tag.php

Member Avatar for diafol
0
463
Member Avatar for ashafaaiz

I use TCPDF library (http://www.tcpdf.org/). It is being actively developed, has examples, it works and it is free.

Member Avatar for agent21
0
668
Member Avatar for davy_yg

> After I download it offline to run it in my localhost, that error start appearing. What do you mean by that? You can not download PHP code from a web page, can you? Anyway, the error you are getting means that you are sending some HTML output before the …

Member Avatar for davy_yg
0
522
Member Avatar for adsegzy

I would use [jquery](http://jquery.com/) and either [hover](http://api.jquery.com/hover/) or [on](http://api.jquery.com/on/) method. The later is preferred since it gives more controls over event handling.

Member Avatar for adsegzy
0
279
Member Avatar for just_program

Where is the information about the logged-in user stored? Let's assume that is stored in the session in the `$_SESSION['loggedin_username']` variable. Now while fetching rows you have to check whether the fetched username equals to the logged-in username. So the code would be something like: <?php include('includes/setting.php'); $for=mysql_query('SELECT * FROM …

Member Avatar for broj1
0
114
Member Avatar for noel9

In general you: 1. check for existence of any input (in $_GET or $_POST) 2. clean existing input 3. display it in the corresponding form fields For detailed answer you should post your existing code.

Member Avatar for broj1
0
135
Member Avatar for Mohamed_26

Newline in HTML is `<br>` tag (a break): echo $row_selecttemptable['ArtistName'] . ' ,<br>' . $row_selecttemptable['NAMEOfTheDVD'];`

Member Avatar for diafol
0
276
Member Avatar for Rahu; joahi

> i want to know about php.net language? [php.net](http://php.net/) is actually a website (that incidentally tells you all about PHP). Seems like you are new to this forum. Welcome and hope you will find it useful. And since your question is pretty general I suggest you read [this article](http://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question) first …

Member Avatar for Mohamed_26
0
278
Member Avatar for Dragon840215

For one thing you are missing quotes arround associative index names. Since the array elements are complex variables you should also enclose them in curly braces to get them parsed properly in a double quoted string. Another issue is that you echo the if condition which is not right. Then …

Member Avatar for Dragon840215
0
2K
Member Avatar for Borderline

The code on line 9 is wrong, it wont return what you expect. You could change your query a bit and ad `AS` to the substring expression in the query: SELECT runners.raceid, SUBSTRING(runners.raceid,1,4) AS raceyear,... and then change line 9 in the code to: echo $row['raceyear'];

Member Avatar for Borderline
0
159
Member Avatar for chrisschristou

Use javascript and on change event on the quantitiy input field that would triger a function. Something like (not tested): <input name="quantity" type="number" min="1" max="20" value="1" id="quantityfield" onchange="updateQuantity();"> ... <script type="text/javascript"> function updateQuantity() { var quantity = document.getElementById("quantityfield").value; var price = <?php echo $row_itemdetaille['price']; ?>; document.getElementById("totalfield").value = quantity * price; …

Member Avatar for chrisschristou
0
3K
Member Avatar for chrisschristou

To get the same hash use the same string for 30 days. There are many ways to accomplish this. One of them could be: Initially: - store the initial string for hashing in the users record in database - set the cookie that expires in 30 days Everytime you need …

Member Avatar for chrisschristou
0
339
Member Avatar for RascelleGrepo

Your condition is wrong since it checks if either submit is set (which always is after submitting) or $service_name has some text. The condition is always true and the values are inserted (if they do not exist). The correct condition would be using && (and): if($submit=='submit' && strlen($service_name) > 0 …

Member Avatar for RascelleGrepo
0
265
Member Avatar for Iikeloa

It works? The results might be unpredictable. In line 9 the id in $_SESSION['id'] is not existing. So better check for existence before using it: if(isset($_SESSION['id'])) { switch($_SESSION['id']) { ... }

Member Avatar for broj1
0
319
Member Avatar for nidhzee11

Have an array with indexes the values and elements the words you want to represent the values: $numbers_array = array('1' => 'one', '2' => 'two', '3' => 'three'); // wrap everything within form tags echo '<form action="#" method="post">'; // use PHP to construct the select element echo '<select name="numbers">'; foreach($numbers_array …

Member Avatar for rahul_29
0
3K
Member Avatar for Iikeloa

There might be some errors in your script(s), but your web server is not telling you about them since most probably the display of errors is turned off. Change the following settings in your php.ini: error_reporting=E_ALL display_errors=On and restart your web server. The errors could be in the included inc/config.php …

Member Avatar for Iikeloa
0
253
Member Avatar for tony75

On line 5 you are trying to write date object into the text file. It won't go. Also the third argument to the fwrite is optional string leght. I doubt you wanted to use it that way. Change line 5 to something like: fwrite($file, $ip . ' ' . $dt->format('Y-m-d …

Member Avatar for tony75
0
321
Member Avatar for RascelleGrepo

Decide on how many characters you can display. Then change line 30 from: <td ><?php echo $row['service_content']; ?></td> to: <td > <?php $contentLength = strlen($row['service_content']); // check if the length of the content exceeds max number of chars e.g. 120 if($contentLength > 120) { echo substr($row['service_content'], 0, 120) . '...'; …

Member Avatar for broj1
0
427
Member Avatar for navneil

Check what the $array content is. Is it an array of objetcs (this is how you reffer to each row)? To check the contents of the array insert this temporary debug code after line 5 in the second code snippet: die(print_r($array, 1)); This will display the contents of the $array …

Member Avatar for broj1
0
247
Member Avatar for Cristianh21

You have a space in the src URL, just before the $photo variable: echo " ".$results['image']."<a href='http://www.mysite.org/br/s.php?id=$id'><img src='/cate/upload/ $photo' width='100%' height='100%'></a>"

Member Avatar for broj1
0
294
Member Avatar for abhijit_2

Here is and example of a script that resets the password and mails new password to the user. http://www.daveismyname.com/tutorials/php-tutorials/reset-password-script/ I prefer slightly different approach. When user forgets his password he is sent a temporary link to a form where he can create new password. You can find examples by googling …

Member Avatar for diafol
0
140
Member Avatar for yavindu

If you want to learn more about this google for cyclomatic complexity. See [this article](http://en.wikipedia.org/wiki/Cyclomatic_complexity) on Wikipedia.

Member Avatar for diafol
0
109
Member Avatar for Naveed_3

Not exactly a PHP related question but anyway: do you have the ending `</a>` tag? Is your other HTML code OK?

Member Avatar for broj1
0
44
Member Avatar for ImZick

// set the array with month names $monthNames = array('January', 'February', ...); // this is your date in a form of a string $dateString = '2013-12-25'; // change it to an array $dateArray = explode('-', $dateString); // month is the second element (-1 to get the correct index) $Month = …

Member Avatar for broj1
0
328
Member Avatar for Salman Bukharii

You should not echo any output before the header command. Remove line 56: echo "<p class='red-info'> Record Saved! </p>"; so the headers can be sent. This command is pointless anyway since the page would get redirected.

Member Avatar for broj1
0
146
Member Avatar for Tko_1

A bit more code would help. Where do you echo it? Maybe it gets changed somewhere in the process? contest[name] the index should be enclosed in quotes: contest['name'] and enclosed in curly braces if used in a double quoted string: ...id="contest-name" name="{contest['name']}" value="' ...

Member Avatar for broj1
0
100
Member Avatar for baloch123

What was the problem with the layout? TCPDF is quite flexible and I did not have problems creating nice tables.

Member Avatar for jazleeen
0
7K
Member Avatar for EmilyJohnson

To recap the above two posts: // check whether $_GET has any value and if the value is valid // (you might use some more proper validation depending on the value of the movie ID) if(isset($_GET['movie_id']) && !empty($_GET['movie_id'])) { $query = "SELECT movie_name,movie_year,movie_director,movie_leadactor,movie_type,movie_running_time,movie_cost,movie_takings FROM movie WHERE movie_id= " . mysql_real_escape_string($_GET['movie_id']); …

Member Avatar for EmilyJohnson
0
301
Member Avatar for Giedrius_1

Maybe the simplest way would be to address the array element directly: $eng['profile_permission'] = 'You belong to ' . $group . ' with a permission of ' . $permission .''; or using double quotes: $eng['profile_permission'] = "You belong to $group with a permission of $permission";

Member Avatar for broj1
0
217
Member Avatar for broj1

Just to alert admins that some spamming is just happenning in the PHP forum here on Daniweb. Please take a look.

Member Avatar for Dani
1
127
Member Avatar for Izzah_1

> i don't understand. how does this solve my problem? If number of [affected rows](http://www.php.net/manual/en/function.mysql-affected-rows.php) equals 0 no rows were deleted. That might be the case if no rows matched $idURL. But to check there are no other issues, use simple debugging technique - insert this code right after line …

Member Avatar for diafol
0
336
Member Avatar for sigvewinter

If the array that is sent as a parameter to the $liquid->render() method has to have same form as teh $assigns array then you have to read the data from the database and put it into an array of the above mentioned form. The details depend on the table structures …

Member Avatar for broj1
0
120
Member Avatar for mysybet

Simply change the action attribute to the same page like: <form method="post" action="#"> or: <form method="post" action="<?php echo __FILE__; ?>">

Member Avatar for broj1
0
51
Member Avatar for nadiam

Show us the rest of the code. From this snippet it is impossible to tell what is wrong. Could be html tags mismatch.

Member Avatar for nadiam
0
405
Member Avatar for Dane2259

Are you viewing this locally? Do you have a web server with php running? Is your script a PHP file? In other words: PHP scripts should have a .php exstension (not .html) and should be run on a PHP enabled web server (could be localhost or a server embeded into …

Member Avatar for broj1
0
333
Member Avatar for jahid32

Videos: https://phpacademy.org/. And of course [php.net](http://www.php.net/manual/en/). It might take some time to get used to it but at the end of the day it is a wealth of information. Everything is there.

Member Avatar for diafol
0
151
Member Avatar for trektrak

Something like: <?php // set styles the way you want if($time < 8) { $tdStyle='background-color:green;'; } else { $tdStyle='background-color:red;'; } while($row=mysql_fetch_array($result)) { echo "</td><td style=\"$tdStyle\">"; echo $row['full_name']; echo "</td><td style=\"$tdStyle\">"; echo $row['section']; echo "</td><td style=\"$tdStyle\">"; echo $row['time']; echo "</td><td style=\"$tdStyle\">"; echo $row['reason']; echo "</td></tr>"; } echo "</table>"; ?> Please note …

Member Avatar for trektrak
0
5K
Member Avatar for chrisschristou

Check out if the `$insertGoTo` variable has same value in both cases. Put this temporary line of code just before line 16: die($insertGoTo); Now see if the same value is displayed on the localhost and the web hosting server. And also: you can simplify the header function like this: header("Location: …

Member Avatar for chrisschristou
0
1K
Member Avatar for Indians

You can do it all in Javascript if you do not need server processing. In this case just write a function to convert number to words and fire it on keyup event. Now, if you need to process numbers on a server (as it seems from your post) then you …

Member Avatar for broj1
0
526
Member Avatar for foxwizzy

As far as I can see $res2 does not depend on $query2. Can you put this temporary debug code just after line 38 and post the result here: die($row2['country_name'] . ' ' . $res2);

Member Avatar for broj1
0
171
Member Avatar for fheppell

Maybe this link can help a bit: http://stackoverflow.com/questions/3740845/php-session-without-cookies But keep in mind there are security issues with this.

Member Avatar for fheppell
0
177
Member Avatar for brandon66

Something like (not tested): // check if the number of fields is multiple of 4 if(count($array) % 4 == 0) { // start building the query $query = 'INSERT INTO yourdatabase (`field1`, `field2`, `field3`, `field4`) VALUES '; // add values to the query for($x = 0; $x < $count($array); $x …

Member Avatar for broj1
0
162
Member Avatar for shavezphp

Use [HTML5 video](http://www.html5rocks.com/en/tutorials/video/basics/) tag.

Member Avatar for hag++
0
135

The End.