dennismonsewicz
Members-
Posts
1,136 -
Joined
-
Last visited
Everything posted by dennismonsewicz
-
Well I was looking through the php.net documentation on sending file attachments using the mail() function and someone noted that you could use the mutt functionality in unix (if running your webserver on a unix system). And that is was very easy to use and makes sending attachments very simple. I am currently using a Java based CMS that uses Quercus to parse the PHP and developing PHP in this CMS is kinda obfuscated and so easy and quick solutions are what I am having to look for lol
-
I am trying to send email attachments using the mutt command in unix but when I run the command in my PHP I get no email and no errors... $cmd = "echo '$body' | mutt -s '$subject' -a '$file' mail '$email'"; exec ($cmd); is my mutt command wrong?
-
Thanks for your help, but that did not fix the problem I think it is a permissions problem because I tried it locally and it works, but not on the webserver...
-
I am trying to write some test content to my CSV file and when I run my script everything seems to work properly but when I view the file nothing is in the CSV doc. Code: <?php $file = 'file.csv'; $somecontent = "Hello World"; if(is_writable($file)) { $fp = fopen($file, 'w'); if (!$handle = fopen($file, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($fp); echo 'Hello World'; } else { echo 'File not writable'; } ?>
-
Sweet! I knew I was missing something... this is my first time really diving in ternary operators and really appreciate your help
-
I have the following code that is supposed to display a particular value depending on the IF statement evaluating to being true: value="<?php (isset($savings)) ? $savings : $bigZero;?>" $savings is being set from the DB and $bigZero is set like this: $bigZero = "$000.00"; When I run my script nothing is displayed for the value.
-
[SOLVED] French Collation PHP import into MySQL
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
ok so I fixed my problem... but now when I am trying to load the special chars to the screen they are not being rendered properly... anyway to fix this? -
What is the best collation to use when importing french translation into mysql 5.0+? I have tried everything I know and have researched and nothing is working... certain characters are being stripped or not showing up as they should
-
here is my query: $man_db = mysql_query("SELECT DISTINCT TRIM(manufacturer) FROM portal_deductible WHERE carrier = 'carrier2'")or die(mysql_error()); My results are being populated like so: <select name="manufacturer" onchange="this.form.submit();"> <option>-- Select Manufacturer --</option> <?php while($row = mysql_fetch_object($man_db)) { if($_POST['manufacturer'] == $row->manufacturer) { $s = " SELECTED"; } else { $s = ""; } echo '<option value="' . $row->manufacturer . '" ' . $s . '>' . $row->manufacturer . '</option>'; } ?> </select> I don't get a mysql error or anything, just no results are displayed
-
I am trying to use DISTINCT and TRIM at the same time with a MySQL Query and it is borking out on me.. EX: "SELECT DISTINCT TRIM(col_1) FROM tbl" I get no mysql errors when I run the code just no results
-
but how does this function differe from using the define function?
-
hmmm ok... is it really a helpful function?
-
can someone explain what the declare statement is used for? I read about it in the PHP manual but I am not fully grasping the concept. http://us2.php.net/manual/en/control-structures.declare.php
-
[SOLVED] limiting loop question
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
sweet! it works now! I also had forgot to place a semicolon after the $i++ but thanks for EVERYONE'S help!!! -
[SOLVED] limiting loop question
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
ok so I am trying the second opinion on this loop stuff and here is my code: $i = 0; while($results = mysql_fetch_assoc($structure)) { $i++ if($i == 10) { echo '<td>'; echo $results['Field']; echo '</td>'; $array[] = $results['Field']; break; } } I now get a blank page -
[SOLVED] limiting loop question
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
sweet Thanks!!!!! -
I have been doing a lot of studying up on loops here lately, hence the reason for all of my loop questions, and I am stuck on a particular script I am trying to finish. code: while($results = mysql_fetch_assoc($structure)) { echo '<td>'; echo $results['Field']; echo '</td>'; $array[] = $results['Field']; } How would I go about limiting the number of fields that show up? Here is the SQL query I am using to pull the fields: $tableName = mysql_real_escape_string($_GET['tablename']); $structure = mysql_query("DESCRIBE " . $tableName)or die(mysql_error());
-
[SOLVED] mysql table creation date
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
lol dude you have no idea!!! tks! that worked! -
[SOLVED] mysql table creation date
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
hmmm now I am getting: Resource id #4 when I print_r the mysql_query query code $t = mysql_query("SHOW TABLE STATUS LIKE 'users'")or die(mysql_error()); print_r($t); -
[SOLVED] mysql table creation date
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
here is the code I am using: $t = mysql_query("SHOW users STATUS")or die(mysql_error()); print_r($t); This is the error I am getting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'users STATUS' at line 1 -
Is there anyway in PHP to retrieve the date in which a mysql table was created?
-
[SOLVED] loading a sql file using PHP
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
duh! thanks for everyones help updated code: if(!empty($_FILES['csvFile']['name'])) { $file = $_FILES['csvFile']['name']; $handle = fopen($file, "r"); $contents = fread($handle, filesize($file)); $queries = explode("%BREAK%", $contents); if(count($queries) > 0) { foreach($queries as $query) { if($query == '') { continue; } else { mysql_query($query)or trigger_error(mysql_error(), E_USER_ERROR); } } echo '<p>Your CSV processed correctly!</p>'; } else { echo '<p>There was a problem in trying to execute your CSV file, please <a href="' . LINK . 'add">try again</a>.</p>'; } } else { echo '<p>You must select your file before uploading, please <a href="' . LINK . 'add">try again</a>.</p>'; } -
[SOLVED] loading a sql file using PHP
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
SWEET! It works now! this is so AWESOME!!!! updated code: if(!empty($_FILES['csvFile']['name'])) { $file = $_FILES['csvFile']['name']; $handle = fopen($file, "r"); $contents = fread($handle, filesize($file)); $queries = explode("%BREAK%", $contents); if(count($queries) > 0) { foreach($queries as $query) { if($query == '') { continue; } else { mysql_query($query)or trigger_error(mysql_error(), E_USER_ERROR); echo '<p>Your CSV processed correctly!</p>'; } } } else { echo '<p>There was a problem in trying to execute your CSV file, please <a href="' . LINK . 'add">try again</a>.</p>'; } } else { echo '<p>You must select your file before uploading, please <a href="' . LINK . 'add">try again</a>.</p>'; } One last thing though, how do I get the echo '<p>Your CSV processed correctly!</p>'; to only show up once upon parsing? -
[SOLVED] loading a sql file using PHP
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
that worked thanks!!! But I am getting something weird... It is picking up a blank entry and returning a mysql error Fatal error: Query was empty Code: if(!empty($_FILES['csvFile']['name'])) { $file = $_FILES['csvFile']['name']; $handle = fopen($file, "r"); $contents = fread($handle, filesize($file)); $queries = explode("%BREAK%", $contents); if(count($queries) > 0) { foreach($queries as $query) { if(mysql_query($query)) { echo '<p>Your CSV processed correctly!</p>'; } else { trigger_error(mysql_error(), E_USER_ERROR); } } } else { echo '<p>There was a problem in trying to execute your CSV file, please <a href="' . LINK . 'add">try again</a>.</p>'; } } else { echo '<p>You must select your file before uploading, please <a href="' . LINK . 'add">try again</a>.</p>'; } -
http://us3.php.net/intval