Duke
-
Posts
52 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Duke
-
-
I Found my error.....My error was that I did not have a "product_id" column in my CARTS Table
Thank you.
-
Hi
RE: Chapter 9 cart.php...
the following code..
//display carts contents
$r = mysqli_query($dbc, "CALL get_shopping_cart_contents('$uid')");
if(!$r) echo mysqli_error($dbc);is causing this error on page
Unknown column 'c.product_id' in 'on clause'
I went over my stored procedure...could not find an error..resorted to copy and pasting stored procedure from book download.....My question is could my error still be in this stored procedure?
Thank you
-
Thank you for your help Larry... I had an error in my stored procedure...
-
Hi
Chapter 8 index.php-home page Display where a few items on sale are show
I am using $r = mysqli_query($dbc, 'CALL select_sale_items(true)');.....this is not formatting the price(ie 500)
I change to $r = mysqli_query($dbc, 'CALL select_sale_items(false)');...this is formatting the price(ie$5.00)
I am thinking there is an error in my select_sale_items stored procedure in the IF beginning section.. I have not found the error.. My Question is... Could I be not seeing the error in this stored procedure?
Thank you
-
Hi
RE: mod_rewrite rule
If mod_rewrite is working for coffee and goodies..Providing code is correct...mod_rewrite should also work for sales...Correct?
Here is the re_write I am using for sales
#For sales:
RewriteRule ^shop/sales/?$ /sales.phpThank you
-
Yes Sorry Larry..Yes still having problem...
...I did notice in the book for the below line in the ipn.php script ... txn_type uses 'web_accept'
if(($_SERVER['REQUEST_METHOD'] === 'POST') && isset($_POST['txn_id']) && ($_POST['txn_type'] === 'web_accept'))
When I log into paypal and go Instant Payment Notification details (below is how to get there)
Profile->My Selling tools->ipn->click-update->IPN History page->Message ID-Click
I am getting back two messages.
one____IPN type
Transaction made.......USES....txn_type=subscr_payment
two----IPN type
Recurring payment profile....USES.....txn_type=subscr_signupI tried using each still not working
I also checked for all the values in the IPN Message and they are all there including the custom value(user_id)
HTTP response code = 200
I was was basically just wondering if the code in my last post looked correct. Or if there are any known issues in the book or download as I have not been able to find any in the forums...
Thank you for any help you can add.
-
oK... I think my error is here...it all look sgood to me...
------------------------------------------
$ch = curl_init();
//configure curl
curl_setopt_array($ch, array (
CURLOPT_URL => 'https//www.paypal.com/cgi-bin/webscr',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(array('cmd' => '_notify-validate') + $_POST),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false ) );
//perform curl request
$response = curl_exec($ch);
//get status of curl response
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
//close curl
curl_close($ch);-------------------------------------
-
RE: ipn.php script..is the code in the book or the download have errors...?
I noticed at least one discrepency between
on line 8 book has
if($status === 200 && $response =='VERIFIED')
download has
if ($status === 200 && $response === 'SUCCESS')
just having trouble getting this script to work so I cannot really post a question. just wondering if there are any known errors as I have not found any posted in the forums
Thank you
-
Got it, thanks Larry
-
I think I was asking question wrong..I want to create a unique id ie. $active =md5(uniqid(rand(), true)); as used to activate a user...I want each contact to have its own random id say anywhere from 10 plus characters long. Sorry for the confusion...I think my best bet is to create this in FM. I just was not sure if MySQLI had a way of creating it as opposed to creating with it with PHP and then inserting into MySQL....I am just not very familiar yet with MySQL. Thank you David
-
Hey Thanks Larry for the tips.... After sleeping on this I thought about first creating a hash field in FM and then exporting to MySQL..I believe a hash can be created with some FM scripting...Thanks for you idea on exporting as CSV...
Regards
David
-
I have a database(Using Filemaker) of contact info .ie name, email address ect...I want to import the data into a mysql table...my question... can mysl create a hash(and insert it into a column say called hash) to be associated with each contact?
-
Hey thanks for the tips....It seems to be faster-may have been my data...if it slows again..I will try moving distance calc. to PHP side...also just made it a little more complicated as I added another query to find records within the found set of first query and not display the found records.....tried to used one large query for both..just not able to get it going....
-
I am using a variation of the distance computation in Chp 3.... I do not have a large amount of data in the mySqli database... The query takes a very long time to run....I found it has to do with calculating the distance in the query...Was wondering if anyone else had this issue or has any thoughts...My query>>>
$sr="SELECT l.load_id, CONVERT_TZ(l.date_posted,'UTC','$tz') AS date_posted,DATE_FORMAT(l.date_available, '%m/%d/%y') AS date_available ,e.equipment_type,e.equipment_size,e.weight,e.hazmat,e.liquor,e.bonded, e.xtra_pickup,e.xtra_delivery,o.city_origin, o.state_origin,o.zip_origin,d.city_destination,d.state_destination,d.zip_destination,l.shipper_id, l.comment, l.pickup_time, l.delivery_day, l.delivery_time, l.rate,l.commodity,s.company_name, s.broker_mc,ROUND(DEGREES(ACOS(SIN(RADIANS('$lat_origin'))* SIN(RADIANS(latitude_origin))+ COS(RADIANS('$lat_origin'))* COS(RADIANS(latitude_origin))* COS(RADIANS('$long_origin' - longitude_origin)))) * 69.09)AS distance_origin,ROUND(DEGREES(ACOS(SIN(RADIANS('$lat_destination'))* SIN(RADIANS(latitude_destination))+ COS(RADIANS('$lat_destination'))* COS(RADIANS(latitude_destination))* COS(RADIANS('$long_destination' - longitude_destination)))) * 69.09)AS distance_destinationFROM loads AS lINNER JOIN origin AS o USING(load_id)INNER JOIN destination AS d USING(load_id)INNER JOIN equipment AS e USING(load_id)INNER JOIN shippers AS sWHEREs.shipper_id = l.shipper_idAND$search_for ";....<<<this varies as to what fields the users wants to search..I useif( (empty($_POST['company_name']))....to select the appropriate $search_for query....Many thanksUpdate...I just emptied the tables and reloaded new data....some of my lat and long fields had zeros as I added these fields recently......I only have about 8 columns in now and is quering much faster....... -
Yes ..I agree....the less info in the url the better....I like the POST way in the delete script..i think its script 10.4
-
Yes thank you..I have a primary key....I using primary key in url....in a link.....ie.....edit_user.php?user_id=1..."1" being the primary key.......I am using scripts similiar to scripts 10.1 & 10.3..edit use.....I think what I was trying to remember was not to use the column name in the url..ie in this case do not use edit_user.php?user_id=1..use a generic name ie edit_user.php?genericname=1....read it somewhere not sure where...thank you for your help
-
Thank for the quick response....I was trying to type short hand to keep the ? brief......What i meant was...should I create another column strictly for use in $_GET['query_id'] querys.... My concern is that the primary key would display in the url......Its just that for some reason and I may be wrong... I remeber reading something about this....Thank you
-
Finished all scripts in book...participated in Boston PHP http://www.meetup.com/bostonphp/events/130131632/ ...great book and great self study....I think i rmeber reading about this but not sure......
when using $_GET['id'] in a mysql query...ie..WHERE user_id(primary key)= $_GET[id']...is this good practice?..or should I create another id in db specifically for a query..?
-
wessmith4....Here is a thought from a newbie..I just used this,,,,,,.
If you want to add a new random key to the attendees in place of your #34.....use php mt_rand() + current timestamp and grab x numbers......ie(-$attendee_id = substr(time().mt_rand(1,100000),6, 9);-).....then use the variable($attendee_id) in your INSERT query....or if you want to use id from household($_SESSION['household']).... try -$attendee_id=$_SESSION['household'];-then use the variable($attendee_id) in your INSERT query.....hope this helps
-
thanks for the help.....It was a typo error on show_image.php page
-
One of my issues is..which page has the error... popup involves 3 pages...not sure which page - or section to post
-
cannot figure this one out....ch 11 popup window(show_image.php)...I am getting the following error on the pop up window..."The Image...link to image location...cannot be displayed because it contains errors.
Thank you
-
Thanks much for the quick response..Although I was not able to make the above work ...you gave me an idea which did work....I used port forwarding on my router and used a different port for the new host machine(in XAMPP I changed the apache port to match the new port# in the router) and directed it to one machine running both MySql and XAMPP....
Many Thanks......
-
Thank you for the quick response......All machines in one location networked together..like this
internet from street->my router->switch-> desktops and server(running windows 2003)(hosting websites running IIS 6 and also running Filemaker Server)....
I tried this:I opened a new port on router and used port forwarding and pointed to my desktop then on the web page "mysqli_connect.php" I tried to change the address to the url(as I have done with filemaker) and added the new port number.."DEFINE('DB_HOST', 'url:port#');"...........did not work....if i followed along in the book...is this correct..."DEFINE('DB_USER','root');....?"..I know you are busy so if you do not have time to respond ..no worries...,,.I am currently a member of the Boston PHP Percolate 6.....I am just trying to connect to use examples in the book(finished exerciese in ch 9)...no plans yet to use in production although I may try and use the technology in the future in real time
Many Thanks, David
Chapter 10 Checkout.php
in Effortless E-Commerce with PHP and MySQL (2nd Edition)
Posted
RE: checkout.php...p 301 step17...just showing a work around that works at this stage of chp 10
could not get this line to return the id...$r = mysqli_query($dbc, 'SELECT @cid'); as a result there is no value to store in list($_SESSION['customer_id']) = mysqli_fetch_array($r);...(even reworked the stored procedure for add_customer..no luck
My work around:
I set $cid = mt_rand(100000,1000000000);
added customer_id column to customer's table....
changed the stored procedure=add_customer...to also include customer_id...and....VALUE.... $cid
changed setting session to: $_SESSION['customer_id'] = $cid;
this seems to be working at this stage of chp 10...