[PHP] putting variables in a variable

2008-03-28 Thread Hulf
Hi,

I am making and HTML email. I have 3 images to put in. Currently I have

$body .=
table
  tr
tdimg src=\image1.jpg\/td
  /tr

  tr
td/td
  /tr
/table
;


ideally I would like to have

$myimage1 = image1.jpg;
$myimage2 = image2.jpg;
$myimage3 = image3.jpg;


and put them into the HTML body variable. I have tried escaping them in 
every way i can think of, dots and slashes and the rest. Any ideas?


Ross



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP ide?

2007-11-08 Thread Hulf
Just wondering if anyone uses an IDE and if so what ones?

Ta,

H. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] isodd() php5?

2007-10-30 Thread Hulf
Hi,

Is there a built in function in PHP5 to determine if an integer is even or 
odd?


Ross 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] moving over to php 5

2007-10-29 Thread Hulf
Hi,


It is about time I made the jump to 5, however the only thing that is 
holding me back is the problem with hosts. How many hosts still run php 4 
and am I going to have to spend hours and hours persuading them to upgrade 
before I can run my code?

I have very little time as it is and am anxious that this is going to be 
swallowed up on the phone to hosing companies and their rubbish technical 
staff.

Please let me know if I will find this an easy transition or should I hold 
off for now.


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] what is the point of prepare?

2007-10-29 Thread Hulf
Hi,

Begining using the php5 mysql functions and want to know what is the point of 
preparing/binding the data before I insert it?

$prep = $mysqli-prepare (INSERT INTO cd (cdid,title,artist) VALUES 
('0',?,?));
$prep-bind_param ('22',$title,$artist);

Ta,

R.


[PHP] problem with bind_param

2007-10-29 Thread Hulf
Hi,

I am still having poblems with the php5 functions. I have 4 variables in 
each. What is the problem?


Warning: mysqli_stmt::bind_param() [function.mysqli-stmt-bind-param]: Number 
of elements in type definition string doesn't match number of bind variables 
in  on line 21

$prep = $mysqli-prepare (UPDATE events SET title=?, date=?, content=?, 
imageUrl=?);
$prep-bind_param ( $_POST['title'], $_POST['date'], $_POST['content'], 
$_POST['imageUrl']);

thanks,

H. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] problem with download script on safari and ie 7

2007-10-08 Thread Hulf
The problem I am getting is safari just downloads the .php file. IE7 
corrupts the binary file. It opens fine on FF and IE6. Is this a headers 
problem?

Thanks,


R.


?php

if(isset($_GET['id']))
{


$id= $_GET['id'];
$query = SELECT file_name, type, size, content FROM results WHERE id = 
'$id';

$result = mysql_query($query) or die(mysql_error());;
list($file_name, $type, $size, $content) = 
mysql_fetch_array($result);

/*echo $file_name;
echo $type;
echo $size;*/


header(Content-Type: $type);
header(Content-Disposition: attachment; filename=$file_name);
header(Content-Length: .filesize($file));
header(Accept-Ranges: bytes);
header(Pragma: no-cache);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Content-transfer-encoding: binary);

echo $content;
exit; 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: problem with download script on safari and ie 7

2007-10-08 Thread Hulf
I changes it now so it is...

header('Content-Type: application/octet-stream');
header(Content-Disposition: attachment; filename=$file_name);
echo $content;
exit;


Which works on ie7 but safari still downloads the .php

R.


Hulf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 The problem I am getting is safari just downloads the .php file. IE7 
 corrupts the binary file. It opens fine on FF and IE6. Is this a headers 
 problem?

 Thanks,


 R.


 ?php

 if(isset($_GET['id']))
 {


 $id= $_GET['id'];
 $query = SELECT file_name, type, size, content FROM results WHERE id = 
 '$id';

 $result = mysql_query($query) or die(mysql_error());;
 list($file_name, $type, $size, $content) = mysql_fetch_array($result);

 /*echo $file_name;
 echo $type;
 echo $size;*/


 header(Content-Type: $type);
 header(Content-Disposition: attachment; filename=$file_name);
 header(Content-Length: .filesize($file));
 header(Accept-Ranges: bytes);
 header(Pragma: no-cache);
 header(Expires: 0);
 header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
 header(Content-transfer-encoding: binary);

 echo $content;
 exit; 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] problems with donwload

2007-09-27 Thread Hulf
Under the results there are 3 files to download. Some users are getting an 
uable to read or corrupt message.

http://vps.aztechost.co.uk/~trisco/index.php


and 3 here

http://vps.aztechost.co.uk/~trisco/rankings.php


The upload script is similar


if(isset($_POST['_upload'])   $_FILES['userfile']['size']  0)
{


$fileName = $_FILES['userfile']['name'];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp  = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}


$id= $_POST['id'];
/*$query = UPDATE results SET title='$title', file_name='$fileName', 
size='$fileSize', type='$fileType',  content='$content', 
last_updated=CURDATE() WHERE id=$id;*/

$query =INSERT INTO results (title, content, file_name, size, type, 
last_updated) VALUES ('$title', '$content', '$fileName', '$fileSize', 
'$fileType', CURDATE());

mysql_query($query);
echo mysql_error();

}


and the download

?php
if(isset($_GET['id']))
{
// if id is set then get the file with the id from database
include(/home/trisco/public_html/secure/scripts/connect.php);

$id= $_GET['id'];
$query = SELECT file_name, type, size, content FROM results WHERE id = 
'$id';

$result = mysql_query($query) or die(mysql_error());;
list($file_name, $type, $size, $content) = 
mysql_fetch_array($result);

/*echo $file_name;
echo $type;
echo $size;*/


header(Content-Type: $type);
header(Content-Disposition: attachment; filename=$file_name);
header(Content-Length: .filesize($file));
header(Accept-Ranges: bytes);
header(Pragma: no-cache);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Content-transfer-encoding: binary);

echo $content;
exit;

}

?


I  can open them on my desktop and laptop. Any clue why this is happening? 
Permissions?


Thanks,


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php downlaod script

2007-09-25 Thread Hulf
My download script only gives me empty (0kb) xls files. They are being 
uploaded as blobs and seem ok. Can someone shed some light on why the 
downoad is not working.

Many Thanks,


R.


?php
if(isset($_GET['id']))
{
// if id is set then get the file with the id from database

$id= $_GET['id'];
$query = SELECT id, file_name, size, type, content FROM results WHERE id = 
'$id';

$result = mysql_query($query) or die(mysql_error());
list($id, $file_name, $type, $size, $content) = mysql_fetch_array($result);

header(Content-Type: application/vnd.ms-excel);
header(Content-Disposition: attachment; filename=$file_name);
header(Content-Length: .filesize($size));
header(Accept-Ranges: bytes);
header(Pragma: no-cache);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Content-transfer-encoding: binary);


exit;
}

? 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] scaling images

2007-09-20 Thread Hulf
I have images of varying sizes. I want them to be scaled prior to upload to 
a set size of 300 x 200 px


$imageinfo = getimagesize($_FILES['userfile']['tmp_name']);

$ix=$imageinfo[0];
$iy=$imageinfo[1];



//upload the images script
I 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: scaling images

2007-09-20 Thread Hulf
Sorry my message was cut off.

Yes I want to scale to 300 x 200px before I upload the image to my folder. 
Here is my code so far.

thanks,

H.


$imageinfo = getimagesize($_FILES['userfile']['tmp_name']);

echo $x=$imageinfo[0];
echo $y=$imageinfo[1];


$newwidth = 300;
$newheight = 200;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($_FILES['userfile']['tmp_name']);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, 
$height);

// Output
$myimage = imagejpeg($thumb);

$target_path = ../property_images/$property_id/.basename( 
$_FILES['userfile']['name']);

$img_url= $property_id./.basename( $_FILES['userfile']['name']);

if(move_uploaded_file($myimage, $target_path)) {
  /*  echo The file .  basename( $_FILES['userfile']['name']).
 has been uploaded;*/
} else{
echo There was an error uploading the file, please try again!;
} 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] scaling and uploading the pt 2

2007-09-20 Thread Hulf
This is the full code so far. The files are saving but they are not 
resizing.

Can anyone help? I need to get this

$myimage = imagejpeg($thumb);

into $target_path directory.


H.

--

if(isset($_POST['_upload'])   $_FILES['userfile']['size']  0)
{

$imageinfo = getimagesize($_FILES['userfile']['tmp_name']);

echo $width=$imageinfo[0];
echo $height=$imageinfo[1];


$newwidth = 300;
$newheight = 200;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($_FILES['userfile']['tmp_name']);

// Resize
$myimage = imagecopyresized($thumb, $source, 0, 0, 0, 0, 300, 200, $width, 
$height);

// Output
$myimage = imagejpeg($thumb);

$target_path = ../property_images/$property_id/.basename( 
$_FILES['userfile']['name']);

$img_url= $property_id./.basename( $_FILES['userfile']['name']);

if(move_uploaded_file($_FILES['userfile']['tmp_name'], $target_path)) {
  /*  echo The file .  basename( $_FILES['userfile']['name']).
 has been uploaded;*/
} else{
echo There was an error uploading the file, please try again!;
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ptting the variable inside the input

2007-08-22 Thread Hulf
This does not work

echo $title=$row['title'];
echo trtdinput name=\title\ type=\text\ value=\$title\ //td;

Ta,

R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] for loop inside a switch

2007-08-16 Thread Hulf
Hi,

switch ($q) {

for ($i=0; $i 21; $i++) {
case 'faq$i':
echo $faq1;
break;
 }
}


I just want to loop out a big long list of cases.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php SHOW

2007-08-03 Thread Hulf
Is there a way to output my data and tables using a php version of SHOW? 
Doesn't have to be pretty HTML just output to screen

Ta,


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] output the schema

2007-08-03 Thread Hulf
Hi,

I reword my last post.

I want to take the result and generate the field info to the screen e.g


id, int(10)
name, varchar(30)
age, varchar(30). 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php SHOW

2007-08-03 Thread Hulf
I mean get the schema.
Hulf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Is there a way to output my data and tables using a php version of SHOW? 
 Doesn't have to be pretty HTML just output to screen

 Ta,


 R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] if inside an echo.

2007-07-31 Thread Hulf
I am outputting a selectbox and want to do the follwoing. How can I add the 
IF statement inside the the echo?


for ($value = 0; $value = 2000; $value += 100) {

 echo option value=\$value\ if ($min_rent==$value) {echo 
selected=selected } $value/option;

  }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php