Search found 28 matches
- Sun Aug 08, 2010 2:53 pm
- Forum: PHP - Code
- Topic: Searching Array values
- Replies: 8
- Views: 1304
Re: Searching Array values
Finally have it working. Due to my poor formatting of the array, we miss interpreted what we were looking for. The complete code is: <p><?php // Is $items already an array? $items = uc_cart_get_contents(); // Set $total to zero $total = 0; // Your check array $checkArray = array(9, 20, 44, 17, 3); /...
- Sun Aug 08, 2010 6:51 am
- Forum: PHP - Code
- Topic: Searching Array values
- Replies: 8
- Views: 1304
Re: Searching Array values
If it helps: Cannot use object of type stdClass as array in That is the error I get. I found this earlier: http://www.ubercart.org/forum/support/11145/uc_cart_get_contents_specific_item_variable , not sure if it will help. I need to get this sorted tonight (if at all possible) and I cant seem to fin...
- Sun Aug 08, 2010 6:21 am
- Forum: PHP - Code
- Topic: Searching Array values
- Replies: 8
- Views: 1304
Re: Searching Array values
I dont get anything come up.
The only time I get something come up is: asking to print the entire items array.
The only time I get something come up is: asking to print the entire items array.
- Sun Aug 08, 2010 5:05 am
- Forum: PHP - Code
- Topic: Searching Array values
- Replies: 8
- Views: 1304
Re: Searching Array values
Hi Thanks for help so far. The code seems to be getting the correct information, but the check condition is never true. For example, I have a product with model "227" which is in the array, but the condition is still evaluating as false, therefore adding to the total. Could it be something...
- Sat Aug 07, 2010 5:30 pm
- Forum: PHP - Code
- Topic: Searching Array values
- Replies: 8
- Views: 1304
Re: Searching Array values
Do you mean like this?
Code: Select all
$items = uc_cart_get_contents();
$itemsarray = (array) $items; //Product Array
$checkarray = array(9, 7, 44, 17, 3);
foreach($itemsarray as $model)
{
if (in_array(uc_product['model'], $checkarray))
{ }
else
{$Total == $Total + ['price'];}
}- Sat Aug 07, 2010 4:42 pm
- Forum: PHP - Code
- Topic: Searching Array values
- Replies: 8
- Views: 1304
Searching Array values
Hi, I am in the final stages of an e-commerce project, and I want to check the cart objects. I know that I must be doing some really silly things here but I cant work out what. Here is the array of information I am given: Array ( [0] => stdClass Object ( [cart_item_id] => 171 [cart_id] => 1 [nid] =>...
- Fri Jul 23, 2010 2:38 pm
- Forum: PHP - Code
- Topic: Variable Containing HTML
- Replies: 2
- Views: 58
Re: Variable Containing HTML
Is there a way I can tell the file that it is plain text as well?
I am currently putting it in quotes via the following method:
Is this correct?
Kind Regards
Tom
I am currently putting it in quotes via the following method:
Code: Select all
$bodynew = '"'. $body . '"';Kind Regards
Tom
- Fri Jul 23, 2010 6:22 am
- Forum: PHP - Code
- Topic: Variable Containing HTML
- Replies: 2
- Views: 58
Variable Containing HTML
hi, I am using code to write to a file (this is the line that is of interest), $csvdata = $model . ',' . $newcatagory . ',' . $title . ',' . $bodynew . ',' . $amount930 . ',' . $amount900 . ',' . $amount915 . ',' . $amount946 . ',' . $amount960 ."\n"; I am writing it into a plain text form...
- Thu Jul 15, 2010 2:39 pm
- Forum: PHP - Code
- Topic: Writing to .csv
- Replies: 0
- Views: 287
Writing to .csv
Hi All, I am using the following code to write to a .csv. Unfortunately, it is not actually writing anything in and my array is not working. Any ideas/help/code corrections would be greatly appreciated: <?php //Open DB and file connections mysql_connect("localhost", "dbname", &qu...
- Wed Jul 14, 2010 5:03 pm
- Forum: PHP - Code
- Topic: For Each Loops
- Replies: 3
- Views: 340
Re: For Each Loops
Thanks for the code. Works a treat. Unfortunately, I cant test or think of implementing a single statement query as my client wants to be able to edit it with no PHP knowledge, and it will just become too difficult. Should I have a use for that in the future though, I will make sure to post back to ...
- Wed Jul 14, 2010 2:00 pm
- Forum: PHP - Code
- Topic: For Each Loops
- Replies: 3
- Views: 340
For Each Loops
Hi, I have the following code which is causing me some issues: //Load in all the NID's $result = mysql_query("SELECT nid FROM drupal_node WHERE type = 'product'"); //just get nid not * $row = mysql_fetch_array( $result ); print_r($row); foreach ($row as $info) { //Collect all information f...
- Thu Jul 08, 2010 2:10 pm
- Forum: PHP - Code
- Topic: SQL Select Problem
- Replies: 1
- Views: 53
SQL Select Problem
HI, I am trying to select the "NID" value from the "Drupal_Node" table and return it when the title = a variable. Here is the code I am having problems with: $file_handle = fopen("Product Database.csv", "r"); $Counter = 1; while (!feof($file_handle)) { $produc...
- Wed Jul 07, 2010 6:00 pm
- Forum: PHP - Code
- Topic: Updating tables and Array checking
- Replies: 0
- Views: 104
Updating tables and Array checking
I am having problems with this code: <?php $Set_drop = ''; $Set_price = ''; $Set_export = ''; function products_drop() { If ($Set_drop != '') { mysql_connect("localhost", "dbuser", "dbpass") or die("Connection Failed"); mysql_select_db("dbname")or di...
- Wed Jul 07, 2010 2:48 pm
- Forum: PHP - Code
- Topic: Mysql Query
- Replies: 4
- Views: 78
Re: Mysql Query
Delete node is a pre written function yes. Im wondering, is there a way I can put a hyperlink on a normal HTML form, that when pressed, runs PHP code at the top of that page. As I dont really want to link to another page if I can help it as it will mean running loads of includes. For example, if I h...
- Wed Jul 07, 2010 2:36 pm
- Forum: PHP - Code
- Topic: Mysql Query
- Replies: 4
- Views: 78
Mysql Query
Hi all, I know Im probably being thick here but there is something wrong with my code: <?php mysql_connect("localhost", "dbuser", "dbpass") or die("Connection Failed"); mysql_select_db("db")or die("Connection Failed"); Echo "test"...