awts sowe lol :D, btw so what's wrong? i mean is what is the problem? you have error? or it isn't displaying anything
awts sowe lol :D, btw so what's wrong? i mean is what is the problem? you have error? or it isn't displaying anything
add a variable to catch the value of your your chosen item $tools = $_POST, then display the selected item via id
<?php
$tools = $_POST['tools'];
$server = 'localhost';
$user = 'root';
$password = '';
$mydb = 'Tools';
$table_name = 'Inventory';
$SQLcmd = "select * from $table_name WHERE id=".$tools;
$connect = mysql_connect($server, $user, $password);
if (!$connect) {
die ("Cannot connect to the $server using $user"); }
else {
mysql_select_db($mydb, $connect);
$result = mysql_query($SQLcmd, $connect) or die(mysql_error());
print '<table border = 1>';
print '<tr><td>Item Name</td><td>Number Sold</td><td>Profit</td></tr>';
while($row = mysql_fetch_array($result)){
print '<tr>';
print "<td> {$row['Name']} </td>";
print "<td> {$row['Sold']} </td>";
$Profits = ($row['Price'] - $row['Cost']) * $row['Sold'] ;
print "<td> $Profits </td>";
print '</tr>';
}
print '</table>';
}
mysql_close($connect);
?>
then put the item id's on it's respective radio field
<html>
<body>
<form name="input" action="SQLQuery.php" method="post">
<input type="radio" name="tools" value="1" /> Total profit and number sold for Hammers<br />
<input type="radio" name="tools" value="2" /> Total profit and number sold for Wrenches<br />
<input type="radio" name="tools" value="3" /> Total profit and number sold for Pliers<br />
<input type="radio" name="tools" value="4" /> Total profit and number sold for Handsaw<br />
<input type="radio" name="tools" value="total" /> Total value of items in Inventory<br /><br />
<input type="submit" value="Submit">
</form>
<p>
Click the "Submit" button to query the record.
</p>
</body>
</html>
values 1,2,3 and 4 are just a sample id, changed it to the id on your table
lol you can't send emails directly from localhost, unless you installed an email system already, PHP need a working email system for it to work
you can use javascript
navigator.userAgent
$date = strtotime(date("Y-m-d G:i:s")."+30 days");
what? coming to left side? can explain more clearly?
bwahahaha the dead has been resurrected again ha ha
depend if you like it, you can do any project without MVC it's not really vital you should do MVC every project, there pros and cons on using MVC but i think the thing i like about MVC is the it's structure and workflow, with MVC your files are organized, you divide logic to your view and you had controllers act as routers, with MVC your co-workers will find eaasy to trace your code, because MVC uses URI to determine which controller and method you use. MVC has clean url, Search Engine Friendly. If you decide to use MVC i recommend Code Igniter, it's a very good MVC, it has helper class that can help lessen your work
why button when you can just click them directly? well it's up to you
no don't make a button for the search list view, it's much better if you just make them clickable, wrap them with anchors <a>, add id to link so upon clicking them, you will be redirected to it's detail view, where there you can display your positive and negative comments
set your right timezone date_default_timezone_set('your_timezone');
http://nl3.php.net/manual/en/timezones.php
OR
edit this on the your php.ini, ex.
date.timezone = "America/Los_Angeles"
hey flipgothic haha i don't know if you can understand us right but what we are trying to say is, when you insert use the name-values pairs algorithm, what your using now is your just specifying values it's ok but it follow correct order based on your table structure, you must've inserted the values incorrectly in wrong order, ex of pairing name-values query
mysql_query("INSERT INTO Persons (FirstName, LastName, Age) VALUES ('Glenn', 'Quagmire', '33')");
and btw ha ha of course it's gonna return blank if your insert.php is empty you got to put your insert code there and put whatever output you want to display :D
lol, don't forget to terminate all statements with semicolon :D
put this above html
$user = $_POST['compid'];
$pass = $_POST['pword'];
$db=mysql_connect('localhost','root','') or die('Cannot connect to MySQL!');
@mysql_select_db('dbriomra')or die('Cannot connect to database');
session_start();
$sql = mysql_query("SELECT * FROM login WHERE username = '".$user."'");
if(mysql_num_rows($sql)>0){
// login
while($row=mysql_fetch_array($sql)){
if($pass==$row['password']){
// store id as session
$_SESSION['id'] = $row['id'];
echo "<script>window.location='/employee.php'</script>";
}else{
// password incorrect
echo 'password incorrect';
}
}
}else{
// fail
echo "username doesn't exist";
}
then remove the action attribute in your form
1st you got to create a list view for person, you can list them up using <ul> then have them assign checkboxes each, then assign some id on every checkbox so you can specify which record to delete
unlink works, if it doesn't then there's problem with your path, if you doubt it's functionality, try doing simple test, like unlink(test.php); putting unlink script and test.php into the same directory
changed this www.mywebsite.com/PB.php/offer=9384736 to www.mywebsite.com/PB.php?offer=9384736, then use session, to identify who completed the offer by getting it's primary id
@pizzipie haha not like that my friend, i think there's a link there, just above the post textbox :D
glad to help my friend, actually im just really giving you advise, it was really you who solved the problem :) , btw is this problem solved? one way of saying thanks is marking this thread solved :D
btw i find it hard to debug here in my end because of your includes, i don't them files you know, well nevermind i don't know if im helping you but i don't really know what you want to achieve
hey dude, one thing is bugging me, if you use json to return values why are you commenting json_encode($rowsSaved)? and just so you know everything you echo or printf is returned when call ajax
ok try changing this
$.post("revise.php", {id: revId, revData: revFlg, dName: dispName}, showResultsFromServer, "json");
to
$.post("revise.php", {id: revId, revData: revFlg, dName: dispName}, showResultsFromServer);
ok ill be back ill just have my lunch
hey dude, i assume you know how to use firebug, try to check firebug's NET tab, and then check your request there, then click on the response tab, to see the response, because you could've error on your revise.php
can you attach your database here as well? ill try to dump them on my database and try to work that here on my end
@cereal ha ha yeah man i already done that setting it in absolute path, then restarting the server, the php for php-cgi works fine, it's PHP scripts. well thanks for the reply anyways, ill try to figure out this myself then :)
you got typo error, you type $did instead of $id
changed this code
echo '<option value='.$did.'>'.$dname.'</option>'."\n";
to
echo '<option value='.$id.'>'.$dname.'</option>'."\n";
basing on the title... want to get inside PHP? then you have to start at the basic, learn the native php then if you want to go advance learn OOP as most of frameworks are OOP
and btw i don't think you are a scale of 3 out of 10, your code is complicated it uses, php + (jquery)ajax + json
there's nothing wrong with your code, have you tried alerting your content 1st? and where is your #rbox
@cereal hey dude thanks for the reply.... yes im using localhost were gonna be developing some php project on nginx soon so i wanna 1st familiarize myself on this, i've managed to run php and mysql now i want to learn how to add virtual host. yes i already done that on the host file, 127.0.0.1 gecko.local, actually i know how to create virtual host, but on apache not on nginx. After adding the servername on the hostfile, i updated the nginx.conf file and entered some server block, but i only managed to call the servername which is gecko.local but it's not pointing to the subdirectory i want it to point, it still pointing at the root folder.
my directory hierarchy is like this (ill show you an absoulute path)
C:/nginx/html/ <----- this is the root right
C:/nginx/html/gecko/ <--- this is the directory i want my virtual host to point
now on my nginx.conf i added inside the http block
server {
listen 80;
server_name gecko.local;
location / {
root html/gecko; #i also tried absolute path C:/nginx/html/gecko
index index.php;
}
}
i also tried this
server {
listen 80;
server_name gecko.local
index index.php
root html/gecko;
}
also this
server {
listen 80;
server_name gecko.local;
rewrite ^ http://gecko.local$request_uri? permanent;
}
there's nothing we can do if we can't edit it's hmtl or php script? you don't expect me to magically fix that right?
@viribium the code ive given to you was a combination of your both index.php and insert.php, so put that code in your index.php and remove line 11
or die(mysql_error());
no it returns 0 if column is not auto incremented
it's because it is not incremented! did you get my point? because he did not increment his primary id, all his id including his last id is zero
ok i need someone to answer this
what is the plural of rice?
i can help you with that, but let me ask you 1st can you edit it's html?
your new to PHP? but your doing joomla? for me, going directly to CMS is a bad choice for starters, it's better if you 1st familiarize yourself with the basic and native php before you go advance. joomla is framework and it's coding structure is not just typical function structures you see everyday....joomla is an Object Oriented Framework
it doesn't matter if your incrementing your id or not, mysql_insert_id() always return the last inserted id
relative paths:
/directory -> root
directory -> within the directory
../directory -> up one directory
Hey guys anyone here know how to set-up virtual host on nginx? ive tried the manuals but doesn't work for me
ha ha he think we are able to read minds :D
Hi guys i need your help, i need to know how run PHP on nginx, i already installed it but it only reads html files not PHP, it will prompt download the php file. Im super new to this and the tutorial on the net's are complicated. btw im using windows 7, so anybody here had experience setting it up on windows?
i don't even see the count() function on your code lol
"if you were born poor, it's not your fault, but if you die poor, that's your fault" - Bill Gates
try this, just a revision to your code
<?php
mysql_connect("localhost", "root", "test") or die(mysql_error());
mysql_select_db("testdb") or die(mysql_error());
$username = $_POST['name'];
$country = $_POST['country'];
if (isset($_REQUEST['Submit'])) {
mysql_query("INSERT INTO users(name, country) VALUES('$username', '$country' ) ");
or die(mysql_error());
}
?>
<form method="post">
username<input type="text" name="name" value=""> </br>
country<input type="text" name="country" value=""></br>
<input type="submit" name="submit" value="Submit">
</form>
i can't understand what your saying... well nevermind, 1st study how to select the data on your database http://www.w3schools.com/php/php_mysql_select.asp, then loop them on your dropdown field
try this, name this .htaccess and put it to root
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^article/(.+)/([0-9]+)$ article.php?product=$1&side=$2
btw this code only works for that certain pattern article.php/watever/watever, because im also a newbie on htaccess im just still reading right now on the basic parts, maybe the conditional statements in htaccess RewriteCond can do the trick, but i haven't read that part yet :D