PHP Help loading queries?

Hi im quite new to PHP and currently studying it. I have trouble in loading a specific data to be called in a table under its usertype/officename for example.

Product by: [called by php]
Made by: [called by php]

I have already done this but the problem is the usertype/officename i have this code

[php]<?php
if(!isset($_SESSION))
{
session_start();
}
$user = $_SESSION[‘login’];

$server=mysql_connect(“localhost”,“root”);
if (!$server){
die (“Could not Connect”);
}

mysql_select_db(“database1”) or DIE (“No!”);

$load=mysql_query(“select * from account where officename=’$username’”);
$load2=mysql_fetch_array($load);

if ($username==$load2[‘officename’])
{
$select=mysql_query(“select madeby,requestname from makerequest where chairapproval=‘Pending’”);
$select2=mysql_fetch_array($select);
}
?>[/php]

If officename is Office1 then it must only see requests made by people under office1

imagine having 5 different offices can anyone please help me!

thank you!

[php]
$server=mysql_connect(“localhost”,“root”);//yours
$server=mysql_connect("$db_host","$db_username","$db_pass");//mine

[/php]

where is your password for the connect

im only using wampserver. i tried this code still it doesn’t work

[php]<?php
if(!isset($_SESSION))
{
session_start();
}
$username = $_SESSION[‘login’];

$server=mysql_connect(“localhost”,“root”);
if (!$server){
die (“Could not Connect”);
}

mysql_select_db(“sanbedabiddingsystem”) or DIE (“No!”);

$load=mysql_query(“select * from account where officename=‘Information Technology’”);
$load2=mysql_fetch_array($load);

$select=mysql_query(“select * from makerequest where account in(’$load2’) & chairapproval=‘Pending’”);
$select2=mysql_fetch_array($select);

?>[/php]

ok but does it not have a password for mysql

are the tables in the mysql for this code

yes thank you for helping me any help with the code??

does your mysql need a password to get into and grab queries

and what are the tables in your database

in your username part of your database you can add the office field that they are under

thank you for your help it is already solved

ok so what did you do to solve it

Sponsor our Newsletter | Privacy Policy | Terms of Service