$query = "INSERT INTO booking  
            (firstname, 
            address1, 
            days, 
            months, 
            bookingtime, 
            address2, 
            lastname, 
            cdays, 
            cmonths, 
            duration, 
            datefrom, 
            dteCallTimeTo, 
            meettype, 
            county, 
            cnumber', 
            fee, 
            pcode, 
            comments, 
            user_id
            ) values ('$firstname', 
            '$address1', 
            '$days', 
            '$months', 
            '$bookingtime', 
            '$address2', 
            '$lastname', 
            '$cdays', 
            '$cmonths', 
            '$duration', 
            '$datefrom', 
            '$dteCallTimeTo', 
            '$meettype', 
            '$county', 
            '$cnumber', 
            '$fee', 
            '$pcode', 
            '$comments', 
            '$userid')";

you were mixing insert and update syntax.

if the checkboxes are not checked they wont appear in the $_POST superglobal.
Try to print your post data like print_r($_POST) and you would know the reason.

Hi,
Needs to construct the tables with the meta info retrived by another stored procedure I wrote, given the table id or name.
There could be some flaws in the logic, not sure.
The flow is -

  • iterate through one table which stores tbl name, id info
  • pass above info to sp which would return meta info to calling cursor as result set
  • store this result set into temp tbl so that another cursor can iterate through them, to construct "create table query" as a string
  • end inner cursor
  • execute the concatenated string query
  • end main or outer cursor

It looks like below -

CREATE PROCEDURE CREATE_TBL
@tbl_id INT
AS
DECLARE @res nvarchar(200) 
select mcol.NEW_COL, col.DATA_TYPE, col.COLUMN_DEFAULT, col.IS_NULLABLE, col.CHARACTER_MAXIMUM_LENGTH size--, mcol.TBL_ID
from seminator.INFORMATION_SCHEMA.COLUMNS col 
inner join MAPPING_TBL mtbl
on col.TABLE_NAME = mtbl.OLD_TBL collate Latin1_General_CI_AS
inner join MAPPING_COL mcol
on col.COLUMN_NAME = mcol.OLD_COL collate Latin1_General_CI_AS and mcol.TBL_ID = mtbl.ID
where mtbl.ID = @tbl_id
 order by COLUMN_DEFAULT

 GO
-- 

CREATE TABLE #plan(
    NEW_COL varchar(40) NOT NULL,
    DATA_TYPE [varchar](30) NULL,
    COLUMN_DEFAULT [varchar](15) NULL,
    IS_NULL [varchar](10) NULL,
    SIZE [varchar](30) NULL
)
GO

Declare @query varchar(5000)
Declare @tbl_id int
Declare c Cursor For SELECT ID FROM MAPPING_TBL where old_tbl = 'ADRESSE'
Open c

Fetch next From c into @tbl_id

While @@Fetch_Status=0 Begin
   --do operations using this current tbl name
   SET @query = 'CREATE TABLE TBL'
   INSERT INTO #plan EXEC CREATE_TBL @tbl_id
   --select * from #plan
   -------------------------2nd
Declare @col varchar(50)
Declare @type varchar(50)
Declare @def varchar(50)
Declare @is_null varchar(50)
Declare ...

post your code here, use code tags

So here is the html for our first step -
[CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Untitled Document .tableclass{ font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold; font-style:inherit; } .td-class{ color:#FFFFFF; background-color:#666666; }  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word  word

[/CODE]

[QUOTE=dmkc;1049949]Hi everyone, I've been a reader for a long time, now I've joined up, as I'm fairly stumped on this one!!

I'm currently teaching myself mysql and php at work, and have a problem. I am using php to produce a listing of restaurants on a page, and I would like to do the following at the end of each line:

1) If the website field is not blank, display the url (or even just "Website")

2) Make the URL Clickable, and open in a new window.

I've managed to produce the list, however my code has gone south somewhere as the "website" field is displaying even when there is no entry in the database. Also when the link is present it's clickable, but opening in the same window. Can someone help me and tell me where I've gone wrong?

[CODE] <?php
mysql_connect(HOST,USER,PASS);
@mysql_select_db("db303278079") or die( "Unable to select database");
$query="
SELECT * FROM restaurants";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$rest_name=mysql_result($result,$i,"rest_name");
$address=mysql_result($result,$i,"address");
$telephone=mysql_result($result,$i,"telephone");
$website=mysql_result($result,$i,"website");
$cuisine_type=mysql_result($result,$i,"cuisine_type");
$area=mysql_result($result,$i,"area");
echo "$rest_name, $address, $telephone, ($cuisine_type), $area, 'Website'
";
$i++;
}
?>[/CODE]

Thanks in advance for your help :)[/QUOTE]
line7 [CODE]mysql_numrows()[/CODE] should be [CODE]mysql_num_rows()[/CODE]
and the mysql_close() better to put at the end of the script.
Also check if website is a valid url first, if its not opening properly

dmkc commented: thanks for the help, really shows me where I'm going wrong, much appreciated!! :) +0

[QUOTE=Muazam;1049381]Ardav@ I like the setlocale solution, but Em not really looking for a date translator. I really appreciate the scripts you've made, It might be useful when I get my website up.

At the moment I'm learning, the "days" could be "fruits". It doesn't matter. I just wanted to get the function working.

Ardav those scripts above doesn't work ><< Might just be my host. I try another host tomorrow.
Thanks for the help, I really appreciate it =)[/QUOTE]
The script in your #post 8 is modified as below, I am sure it will work for you -
[CODE]<?php
//nodag = Norwegian day
//endag = English Day
// dag = day\

if(!isset($_GET['ok'])) { //start if
?>

English Norsk

<?php
}// end if
elseif(isset($_GET["lan"]) && $_GET["lan"] == "no") { //start elseif
$norwegian_days = array("Monday"=>"Mandag","Tuesday"=>"Tirsdag","Wednesday"=>"Onsdag","Thursday"=>"Torsdag","Friday"=>"Fredag","Saturday"=>"Lordag","Sunday"=>"Sondag");
$endag = date("l");
$nodag = $norwegian_days[$endag];
echo $nodag;
} // end elseif
elseif(isset($_GET["lan"]) && $_GET["lan"] == "eng") { // start else
$endag = date("l");
echo $endag;
}// end else
?>[/CODE]
Hope you noticed the small change

Muazam commented: Very helpful +1
nav33n commented: Darn! I totally missed the == in my post. Good work! +5

[QUOTE=Olsi009;1048703]Hey people,
I am doing a project in web development and I wanted to make a system where users can sign up and login to their profiles and have custom URLs like facebook or twitter ([url]www.mysite.com/UserName[/url]).
I dont wanna create a folder for every user on the system cuz that's a stupid thing to do :)

Hope you can help :)
thnx in advance[/QUOTE]
search for the .htaccess
using it you can rewrite your urls after login from [url]www.mysite.com?userId=9[/url] to something like -
[url]www.mysite.com/username[/url]

@leviathan185: You can definitely use the strings as the cases inside switch()
@Mauzam : need brak after the case sunday and the syntax after the case is wrong, need to use the 'COLONS (i.e. :)' instead of ';'
your improved switch() below -
[CODE]switch($endag) { // start switch
case "Monday":
$nodag = "Mandag";
break;
case "Tuesday":
$nodag = "Tirsdag";
break;
case "Wednesday":
$nodag = "Onsdag";
break;
case "Thursday":
$nodag = "Torsdag";
break;
case "Friday":
$nodag = "Fredag";
break;
case "Saturday":
$nodag = "Lordag";
break;
case "Sunday":
$nodag = "Sondag";
break;
default:
$nodag = "ERROR";
} // end switch
[/CODE]
I did not check with the rest of your code yet,i assume the rest is fine.

[QUOTE=elanorejoseph;1048412][CODE]hi how can i make a drop down menu usibg java script.... please help its urgent[/CODE][/QUOTE]
use html to code the drop down menu , use ajax based fill up of elements in the drop down from some other ajax page in order not to refresh the page.

mysql_real_escape_string()

you can have a look at [URL="http://ajax.phpmagazine.net/2006/04/howto_integrate_google_calenda.html"]this [/URL]for reference.
It will involve creating the API which will link to your database also depending upon the user key(but i think no need to customize it on user basis, because all users will see the public events only in the embeded calendar) to fetch the public events apart from the html it will provide to render the calendar on the webpage.

[QUOTE=venkat0904;1042520]yeah that should help me take off... bt as i stated earlier a user can view his own events as well as of others in same group who have shared an event...
I can think of an addition ie with user id we can save group id of an event, in case the user wishes to share it with the group and while displaying we can check if user's own group id matches with event's group id..
what do u say??[/QUOTE]
its good. see you just needed a little push and now you can fly yourself :)

[QUOTE=venkat0904;1042451]Hi all,

Since its been a while now that i am learning php I undertook a project to develop event calendar in php and mysql. There will be a public calendar published on site which every1 can view. Then as a user logs in he will have his own personal calendar in which he can publish events and share with either a specific group or make it public.

any suggestions to start up with??
especially m pretty confused for DB structure that will help me accomplish this...[/QUOTE]
You can have below table structure -

event_id int(2) not null,
event varchar(30) not null,
event_date date ,
entry_date datetime,
user_id int(2) referes to the usermaster table.
and while displaying the calendar check this table for any event available (for the particular user ,this to be done if the user sees only his events only) for that particular date.

[QUOTE=phouse512;1042240]Table Inventory:

user_id | weapon_id | armor_id | etc_items
-------- -+---------------+------------+------------
............ | ................. | .............. | this is the important part

How would you store multiple things or items in that spot for just one user?[/QUOTE]
No need to do it that way, you can save all the etc_items for one particular user some other table which refers your primary table's key; even though you can save all the items for single user in just one column with comma seperated values.

Do what adatapost says above and use your improved code below -
[CODE]
<?
if (isset($_POST[submit]))
{

foreach($uploadArray as $file)
{  
    //This is the directory where images will be saved
    $target = "orders/";
    $target = $target . basename( $_FILES[$file]['name'] );

    $arr_allowed_types = array("image/gif","image/jpg","image/jpeg","image/pjpeg");

    if( in_array($_FILES[$file]["type"],$$arr_allowed_types) && $_FILES[$file]["size"] < 5000000)
    { 
        if(move_uploaded_file($_FILES[$file]['tmp_name'], $target)) 
        {   
            // redirect to upload success url
            header('Location: ' . SUCCESS_URL);
        }   
        else 
        {
            echo "Sorry, there was a problem uploading your file.";
        }

    }
    else
    {
      echo "Invalid file";
    }

} 

}
?>[/CODE]

__avd commented: Great! +6

your syntax for the else is wrong, it should not have been square brackets there.
your code below -
[CODE]
if(isset($_POST['log']))
{
$username = $_POST['username'];
$pass = $_POST['passd'];

include("connectOrder.php");
$sql = "SELECT * FROM users WHERE user_name='$username' AND password = '$pass' AND access_level != 0";
mysql_query($sql);
$num=mysql_num_rows($sql);
if($num == 1)
{
    session_start();

    $_SESSION["user_id"]=$row_sqllog["user_id"];
    $_SESSION["username"]=$row_sqllog["user_name"];
    header ("Location: order.php");
}
else
{
    header ("Location: login.php?login=wrong");
}

}
[/CODE]
Also make sure the filepath you including is all right and also the same in header.

[QUOTE=sha09;1027982]

i have try this code for retrieved information from database, everything is ok..and for that case i want to use the id to display the whole of data same as i used "this is for example.." but i want that row link to database as an "ID" display for retrieved that row in database..that means the link is the headline to database for that row..#somebody help me....i stuck for this one...[/QUOTE]

still not much is clear from this english, i guess you want to set the next page as complaint.php which will show different containts for each link you click, and will show the details for that particular id.
If that's the case, just pass the id also to this link's href like -
[CODE]

sha09 commented: help me so much +0

[QUOTE=shishtawitch;1021615]i am trying to develop a site.............when i referesh page it gives me the follwoing error
Use of undefined constant admin_mail - assumed 'admin_mail'

i am hosting my site on my home server so i want to set my php.ini so that i didn't get the above error[/QUOTE]
It may be the case that you unknowingly deleted the '$' in front of the variable 'admin_mail'.
search for it in your script

You got the connection? try this-
[CODE]
$this->User->query("select count(*) from (SELECT user_id FROM reports group by report_id) as tb where tb.user_id=5");
[/CODE]

Can you be more descriptive about what you expect from php, like what do you mean by 'uild-in function of authentication' ?

please post your script's part, which you think contains an error.

[CODE]$str = "20px 100% dfsd 10em ";
$test = preg_split('(px|em|pt|%)',$str,-1, PREG_SPLIT_OFFSET_CAPTURE);
//echo '

';
print_r($test);
//echo '
';
[/CODE]
This isn't working either...what can be the code for it

hey what you asking is very broad, about developing a complete form, is this a homework problem.
It seems that, you expect somebody to post the complete code for the form you want.
Try google for some with the keywords like 'inventory management form' etc and try to modify the code as par your needs.then post the difficulties you facing here.
This might be the better approach.

Many Internet Service Providers (ISP's) require that you send your username and password before you are allowed to send email. This is called "Authentication" or "SMTP Auth".

More recently, some ISP's have begun to require that you have TWO separate and different login names - one for checking mail and one for sending mail. This is called "SMTP Relay".
So there might be the problem with your smtp server settings, check with it.

The type of table in mySQL will serve a lot of purpose for this :)
ex. innodb or myISAM
innodb provides the lock on row basis instead of that on complete table.
So ur this type of problem might get solved, just have some research for the table types of mysql and probably you can change your database/table structure to implement it.