Many many times on a page I will have to set post and get values in PHP like this
I just want to know if it is better to just continue doing it the way I have above or if performance would not be touched by adding it into a function like in the code below?
This would make it much easiar to write code but at the expense of making extr...
Hi, I want users on my website to be able to "move" div tags once they are 'unlocked' and then for a php script to store the positions in mysql database. So once the user re-logs in the div tags are positioned in the correct place.
I know how to postion div tags in css, and am using php varibles within css to pull the data from the data...
I need to accomplish the following and need help with #2 below
My site has a page with form and the submitted form data needs to be written to a database on my site.
After it is written to the database, the same data submitted on the form needs to be sent to a page that processes it on another site so as if the form submission came f...
I have a signout button that I need to make work...what is the best way to do that through mysql? thanks
...
I made a PHP script that generates CSV files that were previously generated by another process.
And then, the CSV files have to be imported by yet another process.
The import of the old CSV files works fine, but but when importing the new CSV files there are issues with special characters.
When I open old CSVs with Notepad++, it says t...
Hello,
My problem is
I try to do a simple JOIN between two tables, that both have the id field. My result is an stdClass object, as I use PDO. Does anyone know how can I make a difference between the id of the first table and the id of the second table?
Code
bc. $sql = "SELECT *,
FROM products AS p, products_categories as c
...
Hey there, I am trying to get my signout button to work. This is what I have in my code:
<!-- Signed In -->
<?php if($_SESSION['*****']['AUTH']) { ?>
<div id="signOut">
Sign Out
</div>
<div id="signIn">
<form name="sendEmail" action="index.php" method="post">
<input type="text" name="name" class="text"/>
<i...
the db_connect file:
<?php
//connects to the database
$username = "username";
$password = "password";
$hostname = "host";
$database="database";
$link=mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL".mysql_error());
mysql_select_db($database, $link) or die("Could not select the da...
I have a "best practice" question. I'm developing a OO MVC framework in PHP, and most of the classes interact easily - they are literally declared in the code and used. For instance:
// In class 'getDetails'
$db = new mysqli(.....);
$db->query(.....);
However, there are times when the class and function names are dynamically built. Th...
Hey everybody,
I'm trying to see what would be a good way to validate a US address, I know that there might be not a proper way of doing this, but I'm going for the basic way: #, Street name, City, State, and Zip Code.
Any ideas will be appreciate it. Thanks
...
My .htaccess redirects all requests to /word_here to /page.php?name=word_here. The PHP script then checks if the requested page is in its array of pages.
If not, how can I simulate an error 404?
I tried this, but it didn't work:
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
Am I right in thinking that it's wrong to redirect t...
I am writing an application that helps book exchange between users.
I am using PHP and MySQL, and I am pretty new to them both.
I have 5 tables, 3 data tables and 2 service tables:
user: with user attributes (user_id, name, birth... etc).
book: with book attributes (book_id, name, author, publisher... etc).
copy: represents actual co...
I need help finishing this statement. It is frustrating that two of the PHP phone books here gloss over PDO's almost all together.
All I need to do is check the database for a username that is already taken.
Here is the start of the statement.
$sql = " SELECT * FROM users WHERE userid = '$userid'";
$result = $dbh->query($sql);
Wh...
How do i create an easy login script that does not require a database. I would like it to be safe.
Alright, what about this script, i just made it by my knowledges in php.
<?php
// startar sessionen
session_start();
// username and password
$anvandarID = "ditt_namn";
$losenord = "ditt_password";
if (isset($_POST["anvandarID"]) && i...
i am very new to Adobe Air and i am having a hard time with it.
i want to be able to create a desktop app for clients that communicates with a databse.
im currently used to writing everything in php, which then communicates with MySQL.
also, i plan on using Flex.
1: does Adobe Air communicate directly with the database? or does it co...
With Apache/PHP5, is it possible to get the contents of an uploaded file directly without having it written to the file system?
Not much on Google about this, but it appears that files are always written to a temporary directory once they are uploaded.
...
Which one below is correct? First code has no quotes in the $_GET array and the second one does, I know you are supposed to have them when it is a string of text but in this case it is a variable, also what about if the key is a number?
no quotes
function arg_p($name, $default = null) {
return (isset($_GET[$name])) ? $_GET[$name] : ...
Hi, i am fetching a text from mysql database and i get it by ID in the url:
site.php?id=1 and so on
What is considered to be most safe to prevent sql injection and stuff. Is this way correct:
<?php
$news_id = $_GET['news_id'];
if(!is_numeric($news_id)) die('Wrong');
//mysql_query and stuff here
?>
OR this way:
<?php
$news_id = $_...
I was trying to make a file upload form and checked the PHP documentation to refresh my memory on the subject. Here is a link to the relevant article. All of a sudden I noticed this message:
The MAX_FILE_SIZE hidden field (measured in bytes) must precede the file input field, and its value is the maximum filesize accepted by PHP. Thi...
I have a PHP registration that calls a mysql db for a dropdown box. No worries, it works fine. What I can't figure out though is this:
The box HAS TO populate with a name, but the POST needs to go to an id field. What I mean is this:
REGISTRATION.PHP
function generate_business_selections($default = '')
{
$output = '';
$applicatio...